Commit graph

589 commits

Author SHA1 Message Date
Junio C Hamano 278fcd7deb Merge branch 'maint'
* maint:
  git-svn: avoid fetching files twice in the same revision
2006-12-02 17:26:58 -08:00
Eric Wong 6173c197c9 git-svn: avoid fetching files twice in the same revision
SVN is not entirely consistent in returning log information and
sometimes returns file information when adding subdirectories,
and sometimes it does not (only returning information about the
directory that was added).  This caused git-svn to occasionally
add a file to the list of files to be fetched twice.  Now we
change the data structure to be hash to avoid repeated fetches.

As of now (in master), this only affects repositories fetched
without deltas enabled (file://, and when manually overriden
with GIT_SVN_DELTA_FETCH=0); so this bug mainly affects users of
1.4.4.1 and maint.

Thanks to Florian Weimer for reporting this bug.

[jc: backported for maint]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-02 17:25:34 -08:00
Eric Wong 1ca7558dd8 git-svn: fix multi-init
After the bugfix to connect to repositories where the user has
limited read permissions, multi-init was broken due to our
SVN::Ra connection being limited to working in a subdirectory;
so we now create a new Ra connection for init-ing branches
and another for tags

Along with that fix, allow the user to use the command-line
option flags for multi-init (--revision being the most notable;
but also --no-auth-cache, --config-dir, --username (for passing
to SVN), and --shared/--template for passing to git-init-db

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 20:59:43 -08:00
Eric Wong 9aca025849 git-svn: color support for the log command
* match LESS environment settings to those in pager.c
 * parse diff.color and pager.color settings in the
   config file, and pass --color to git-log
 * --color and --pager= settings are supported

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 20:59:35 -08:00
Eric Wong 0864e3ba12 git-svn: fix output reporting from the delta fetcher
There was nothing printed in the code originally because I left
out a pair of parentheses.  Nevertheless, the affected code has
been replaced with a more efficient version that respects the -q
flag as well as requiring less bandwidth.

We save some bandwidth by not requesting changed paths
information when calling get_log() since we're using the delta
fetcher.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 14:22:52 -08:00
Eric Wong dad73c0bb9 git-svn: error out when the SVN connection fails during a fetch
finish_report does seem to return a useful value indicating success
or failure, so we'll just set a flag when close_edit is called
(it is not called on failures, nor is abort_edit) and check
the flag before proceeding.

Thanks to Pazu for pointing this out.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28 14:13:43 -08:00
Eric Wong 27a1a8014b git-svn: enable delta transfers during fetches when using SVN:: libs
This should drastically reduce bandwidth used for network
transfers.  This is not enabled for file:// repositories by
default because of the increased CPU usage and I/O needed.

GIT_SVN_DELTA_FETCH may be set to a true value to enable or
false (0) to disable delta transfers regardless of the
repository type.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-27 22:22:57 -08:00
Eric Wong 6f23ebf600 git-svn: use ~/.subversion config files when using SVN:: libraries
This allows users to use HTTP proxy information (among other settings)
from ~/.subversion/servers and ~/.subversion/config

--config-dir (as before) may be passed to git-svn to override the
default choice of '~/.subversion' for the configuration directory.

Thanks to tko on #git for pointing this out.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-27 13:55:49 -08:00
Eric Wong efe4631def git-svn: allow SVN:: lib users to track the root of the repository (again)
I broke this again in 747fa12cef.

Thanks to merlyn for pointing this out to me on IRC.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 19:59:32 -08:00
Eric Wong d25c26e771 git-svn: exit with status 1 for test failures
Some versions of the SVN libraries cause die() to exit with 255,
and 40cf043389 tightened up
test_expect_failure to reject return values >128.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 23:17:00 -08:00
Eric Wong 747fa12cef git-svn: correctly access repos when only given partial read permissions
Sometimes users are given only read access to a subtree inside a
repository, and git-svn could not read log information (and thus
fetch commits) when connecting a session to the root of the
repository.  We now start an SVN::Ra session with the full URL
of what we're tracking, and not the repository root as before.

This change was made much easier with a cleanup of
repo_path_split() usage as well as improving the accounting of
authentication batons.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 23:16:58 -08:00
Eric Wong 30d055aa1e git-svn: handle authentication without relying on cached tokens on disk
This is mostly gleaned off SVN::Mirror, with added support for
--no-auth-cache and --config-dir.

Even with this patch, git-svn does not yet support repositories
where the user only has partial read permissions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 02:23:22 -08:00
Eric Wong 4769489a41 git-svn: preserve uncommitted changes after dcommit
Using dcommit could cause the user to lose uncommitted changes
during the reset --hard operation, so change it to reset --mixed.

If dcommit chooses the rebase path, then git-rebase will already
error out when local changes are made.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:46 -08:00
Eric Wong e70dc780a4 git-svn: correctly handle revision 0 in SVN repositories
some SVN repositories have a revision 0 (committed by no author
and no date) when created; so when we need to ensure that we
check any revision variables are defined, and not just
non-zero.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:45 -08:00
Eric Wong 48d044b5fe git-svn: error out from dcommit on a parent-less commit
dcommit would unconditionally append "~1" to a commit in order
to generate a diff.  Now we generate a meaningful error message
if we try to generate an impossible diff.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:43 -08:00
Eric Wong 45bf473a7b git-svn: fix dcommit losing changes when out-of-date from svn
There was a bug in dcommit (and commit-diff) which caused deltas
to be generated against the latest version of the changed file
in a repository, and not the revision we are diffing (the tree)
against locally.

This bug can cause recent changes to the svn repository to be
silently clobbered by git-svn if our repository is out-of-date.

Thanks to Steven Grimm for noticing the bug.

The (few) people using the commit-diff command are now required
to use the -r/--revision argument.  dcommit usage is unchanged.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 09:34:46 -08:00
Eric Wong a35a045874 git-svn: don't die on rebuild when --upgrade is specified
--copy-remote and --upgrade are rarely (never?) used together,
so if --copy-remote is specified, that means the user really
wanted to copy the remote ref, and we should fail if that fails.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 09:34:36 -08:00
Eric Wong 75bd7e374e git-svn: avoid printing filenames of files we're not tracking
This is purely an aesthetic change, we already skip importing of
files that don't affect the subdirectory we import.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09 09:34:27 -08:00
Eric Wong 9ffd652a38 git-svn: fix symlink-to-file changes when using command-line svn 1.4.0
I incorrectly thought this was hopelessly broken in svn 1.4.0,
but now it's just broken in that the old method didn't work.  It
looks like svn propdel and svn propset must be used now and the
(imho) more obvious svn rm --force && svn add no longer works.

"make -C t full-svn-test" should now work.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Acked-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-24 15:15:51 -07:00
Eric Wong f7197dff15 git-svn: reduce memory usage for large commits
apply_textdelta and send_stream can use a separate pool from the
rest of the editor interface, so we'll use a separate SVN::Pool
for them and clear the pool after each file is sent to SVN.

This drastically reduces memory usage per-changeset committed,
and makes large commits (and initial imports) of several
thousand files possible.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14 17:38:52 -07:00
Eric Wong ce91fc6eb9 git-svn: fix commits over svn+ssh://
Once a get_commit_editor has been called from an SVN session, RA
layer operations are not allowed (well, unless you're using
file:// or http(s)://).  So we'll pass an alternate SVN::Ra
object to our editor object for running 'check-path'.

This should fix commits over svnserve (svn:// without ssh, too).

Closes Debian bug #392702, thanks to Pierre Habouzit for
reporting the bug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14 11:48:33 -07:00
Eric Wong 83e9940a5e git-svn: add a message encouraging use of SVN::* libraries
I'm using svn 1.4.0-4 in Debian unstable and apparently there's
a regression on the SVN side that prevents a symlink from
becoming a regular file (which git supports, of course).

It's not a noticeable regression for most people, but this broke
the full-svn-tests target in t/Makefile for me.

The SVN::* Perl libraries seem to have matured and improved over
the past year, and git-svn has supported them for several months
now, so with that I encourage all users to start using the
SVN::* Perl libraries with git-svn.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 20:19:49 -07:00
Eric Wong b203b769f2 git-svn: -h(elp) message formatting fixes
'graft-branches' is slightly longer than the rest of the
commands, so the text was squished together in the formatted
output.  This patch just adds some more whitespace to make
the text look more pleasant.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 15:24:18 -07:00
Eric Wong 74a31a100a git-svn: log command fixes
Change the --verbose flag to more closely match svn.  I was
somehow under the impression that --summary included --raw diff
output, but I was wrong.  We now pass -r --raw --name-status as
arguments if passed -v/--verbose.

-r (recursive) is passed by default, since users usually want
it, and accepting it causes difficulty with the -r<revision>
option used by svn users.  A --non-recursive switch has been
added to disable this.

Of course, --summary, --raw, -p and any other git-log options
can still be passed directly (without --name-status).

Also, several warnings about referencing undefined variables
have been fixed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 14:41:13 -07:00
Eric Wong c35b96e785 git-svn: multi-init saves and reuses --tags and --branches arguments
This should make it much easier to track newly added tags and
branches.  Re-running multi-init without command-line arguments
should now detect new-tags and branches.

--trunk shouldn't change often, but running multi-init on it
is now idempotent.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11 14:41:11 -07:00
Sergey Vlasov 191414c025 git-svn: Fix fetch --no-ignore-externals with GIT_SVN_NO_LIB=1
When using Subversion 1.3.1 without Perl bindings (GIT_SVN_NO_LIB=1),
"git-svn fetch --no-ignore-externals" fails with errors like:

  Tree (.../.git/svn/git-svn/tree) is not clean:
  X      directory_with_external

In this case the 'X' lines in the "svn status" output are not a sign
of unclean tree, and therefore should be ignored.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-26 23:43:12 -07:00
Shawn Pearce 8815788e93 Allow '(no author)' in git-svn's authors file.
When trying to import an SVN revision which has no author the Git
user may desire to relabel '(no author)' to another name and email
address with their svn.authorsfile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:19:28 -07:00
Shawn Pearce f7bae37f9a Allow 'svn fetch' on '(no date)' revisions in Subversion.
Added --ignore-nodate to allow 'git svn fetch' to import revisions
from Subversion which have '(no date)' listed as the date of the
revision.  By default 'git svn fetch' will crash with an error
when encountering such a revision.  The user may restart the fetch
operation by adding --ignore-nodate if they want to continue tracking
that repository.

I'm not entirely sure why a centralized version control system such
as Subversion permits revisions to be created with absolutely no
date/time associated with it but it apparently is possible as one
of the Subversion repositories that I'm tracking with 'git svn'
created such a revision on '(no date)' and by '(no user)'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:19:22 -07:00
Eric Wong 5f641ccc69 git-svn: stop repeatedly reusing the first commit message with dcommit
Excessive use of global variables got me into trouble.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 17:54:15 -07:00
Eric Wong b22d449721 git-svn: add the 'dcommit' command
This is a high-level wrapper around the 'commit-diff' command
and used to produce cleaner history against the mirrored repository
through rebase/reset usage.

It's basically a more polished version of this:

for i in `git rev-list --no-merges remotes/git-svn..HEAD | tac`; do
	git-svn commit-diff $i~1 $i
done
git reset --hard remotes/git-svn

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-26 00:59:29 -07:00
Eric Wong 5a990e45f9 git-svn: establish new connections on commit after fork
SVN seems to have a problem with https:// repositories from
time-to-time when doing multiple, sequential commits.  This
problem is not consistently reproducible without the patch,
but it should go away entirely with this patch...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 21:26:21 -07:00
Eric Wong a69a165fb4 git-svn: split the path from the url correctly with limited perms
This version of the splitter (that only affects SVN:: library
users) works when one only has limited read-permissions to
the repository they're fetching from.

Updated from the original patch to workaround some SVN bug
somewhere, which only seems to happen against file://
repositories...  Here's the diff against the original patch I
submitted:

@@ -1159,8 +1159,8 @@ sub repo_path_split {
 	}

 	if ($_use_lib) {
-		$SVN = libsvn_connect($full_url);
-		my $url = $SVN->get_repos_root;
+		my $tmp = libsvn_connect($full_url);
+		my $url = $tmp->get_repos_root;
 		$full_url =~ s#^\Q$url\E/*##;
 		push @repo_path_split_cache, qr/^(\Q$url\E)/;
 		return ($url, $full_url);

Somehow connecting to a repository with the full url makes the
returned SVN::Ra object act strangely and break things, so now
we just drop the SVN::Ra object that we made our initial
connection with.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 23:55:21 -07:00
Eric Wong 308906fa6e git-svn: bugfix: allow SVN:: lib users to track the root of the repository
I'm not sure if anybody has hit this (besides me), but this
fixes the problem where I ran into while attempting to import a
small repo at the root level:  I ended up with all the commits, but
with no file/tree changes at all throughout the entire history.

Also, fix a warning if the commit message is not defined for revision 0.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 16:21:51 -07:00
Eric Wong 17a10f3709 git-svn: correctly kill keyword expansion without munging EOLs
This bugfix applies to users of the svn command-line client only.

We no longer muck with newlines when killing keyword expansion.
This tended to generate unintended diffs in commits because svn
revert -R would destroy the manual EOL changes we were doing. Of
course, we didn't need the EOL munging in the first place, as
svn seems to do it for us even in the text-base files.

Now we set the mtime and atime the files changed by keyword
expansion killing to avoid triggering a change on svn revert,
which svn still seems to want to do.

Thanks to Seth Falcon for reporting this bug.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 16:16:40 -07:00
Eric Wong d0d8f7dc5f git-svn: fix fetching new directories copies when using SVN:: libs
Log output from SVN doesn't list all the new files that were
added if a new directory was copied from an existing place in
the repository.  This means we'll have to do some extra work and
traverse new directories ourselves.

This has been updated from the original patch to defer traversed
adds until all removals have been done.  Please disregard the
original.

Thanks to Ben Williamson for the excellent bug report and
testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-23 23:35:24 -07:00
Eric Wong 7b520e62a2 git-svn: don't check for migrations/upgrades on commit-diff
Unlike other git-svn commands, commit-diff is intended to
operate without needing any additional metadata inside .git

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-16 13:46:47 -07:00
Pavel Roskin 82e5a82fd7 Fix more typos, primarily in the code
The only visible change is that git-blame doesn't understand
"--compability" anymore, but it does accept "--compatibility" instead,
which is already documented.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 00:36:44 -07:00
Eric Wong 4ad4515dfe git-svn: fix --file/-F option in commit-diff
Also, allow messages from tags to be used as
commit messages.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 00:19:34 -07:00
Eric Wong 60d02ccc18 git-svn: migrate out of contrib
Allow NO_SVN_TESTS to be defined to skip git-svn tests.  These
tests are time-consuming due to SVN being slow, and even more so
if SVN Perl libraries are not available.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-06 17:02:47 -07:00
Renamed from contrib/git-svn/git-svn.perl (Browse further)