Code

git.git
17 years agogit-svn: brown paper bag fixes
Eric Wong [Wed, 14 Feb 2007 21:32:21 +0000 (13:32 -0800)]
git-svn: brown paper bag fixes

  * avoid skipping modification-only changes in fetch
  * correctly fetch when we only have branches and tags
    to glob from (no fetch keys defined)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow 'init' to act as multi-init
Eric Wong [Wed, 14 Feb 2007 20:27:41 +0000 (12:27 -0800)]
git-svn: allow 'init' to act as multi-init

multi-init is now just an alias that requires -T/-t/-b;
all options that 'init' can now accept.

This will hopefully simplify usage and reduce typing.

Also, allow the --shared option in 'init' to take an optional
argument now that 'git-init --shared' supports an optional
argument.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: hopefully make 'fetch' more user-friendly
Eric Wong [Wed, 14 Feb 2007 10:21:19 +0000 (02:21 -0800)]
git-svn: hopefully make 'fetch' more user-friendly

multi-fetch is deprecated, "fetch -a" is easier to type
By default, fetch will fetch everything from its default
[svn-remote]; if fetch [--all|-a] is specified, then it will
fetch from all svn remotes.  Refspecs on the command-line
(like git-fetch) are not supported.

Also, enable -r/--revision arguments for fetch so
users can shoot themselves in the foot^W^W^W^W^W
skip some history and do the equivalent of a shallow
clone/fetch they're not interested in.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agot910*: s/repo-config/config/g; poke around possible race conditions
Eric Wong [Wed, 14 Feb 2007 01:38:58 +0000 (17:38 -0800)]
t910*: s/repo-config/config/g; poke around possible race conditions

Some of the repo-config => config renaming missed the git-svn
tests; so I'm just renaming them to be consisten with the
rest of the modern git.

Also, some of the newer tests didn't have 'poke' in them
to workaround race conditions on fast machines.  This adds
places where they can _possibly_ occur; but I don't have
fast enough hardware to trigger them.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: usability fixes for the 'git svn log' command
Eric Wong [Wed, 14 Feb 2007 01:09:40 +0000 (17:09 -0800)]
git-svn: usability fixes for the 'git svn log' command

Similar in spirit to the recent dcommit change, we now
look at 'HEAD' by default to look for a GIT_SVN_ID
so the user won't have to pass -i <GIT_SVN_ID> argument.

We are also more tolerant of of people passing bare remote names
as a result (just $GIT_SVN_ID without the -i)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: include merges when calling rev-list for decommit
Eric Wong [Tue, 13 Feb 2007 23:56:08 +0000 (15:56 -0800)]
git-svn: include merges when calling rev-list for decommit

Merge commits can be created when following certain parents,
(most notably 'R' cases) and we definitely don't want to exclude
them.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: make dcommit usable for glob users
Eric Wong [Tue, 13 Feb 2007 22:22:11 +0000 (14:22 -0800)]
git-svn: make dcommit usable for glob users

 * dcommit no longer requires the correct -i/GIT_SVN_ID option
   passed to it.  Since you're committing from HEAD (or another
   commit that is a parent of HEAD), you'll be able to find
   a commit with metadata information containing the SVN URL
   that your HEAD was descended from anyways.

 * I don't think dcommit ever worked for people using the
   noMetadata option; so I don't think relying on metadata
   is an issue.

 * useSvmProps users shouldn't commit to SVN::Mirror created
   repositories anyways, right?

 * Users of globbing should automatically be able to commit
   to paths that are not explicitly set in .git/config

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: make test for SVK mirror path import
sam@vilain.net [Tue, 5 Dec 2006 05:17:38 +0000 (16:17 +1100)]
git-svn: make test for SVK mirror path import

A manual test that sets up a repository that looks like an SVK depot,
and then imports it to check that it looks like we mirrored the
'original' source.

There is also a minor modification to the git-svn test library shell
file which sets a variable for the subversion repository's filesystem
path.

[ew: made some of the tests stricter and more thorough]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: handle multi-init without --trunk, UseSvmProps fixes
Eric Wong [Tue, 13 Feb 2007 08:38:02 +0000 (00:38 -0800)]
git-svn: handle multi-init without --trunk, UseSvmProps fixes

multi-init did not write a svn-remote.<remote>.url config
entry without a --trunk argument.

Also, The svm:mirror property is used by SVN::Mirror to track
the path of the repository that we are mirroring.  We need to
append that to the source (which is (presumably) just the URL of
the repository root).

Lastly, we now look harder for svm:(source|mirror|uuid) properties
in sub and parent directories.  Since our relative path could
be tweaked.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: write the highest maxRex out for branches and tags
Eric Wong [Tue, 13 Feb 2007 00:03:32 +0000 (16:03 -0800)]
git-svn: write the highest maxRex out for branches and tags

Even if nothing touched paths we care about in a fetch;
increment the maxRev like we do with rev_db since
we don't like having to run get_log on revisions we've
seen before.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: use separate, per-repository .rev_db files
Eric Wong [Mon, 12 Feb 2007 21:25:25 +0000 (13:25 -0800)]
git-svn: use separate, per-repository .rev_db files

We need a separate .rev_db file for each repository we're
tracking.  This allows us to track the same logical path off
multiple mirrors.  We preserve a symlink to the old .rev_db
(no-UUID) if we're (auto-)migrating from an old version to
preserve backwards compatibility.

Also, get rid of the uuid() wrapper since we cache UUID in our
private config, and the SVN::Ra::get_uuid() function memoizes
the return value per-connection.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: extra safety for noMetadata and useSvmProps users
Eric Wong [Sun, 11 Feb 2007 23:21:24 +0000 (15:21 -0800)]
git-svn: extra safety for noMetadata and useSvmProps users

Make sure we flush our userspace buffers and and fsync(2)
.rev_db information to disk if we use these options because
we really don't want to lose this information.

Also, disallow --use-svm-props and --no-metadata from the
command-line because history will be inconsistent if they're
only used occasionally.  If a user wants to use these options,
they must be set in the config so they're always on.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: use private $GIT_DIR/svn/config file more
Eric Wong [Sun, 11 Feb 2007 09:20:26 +0000 (01:20 -0800)]
git-svn: use private $GIT_DIR/svn/config file more

Switch max_rev storage over to using it for globbing
branches and tags.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add support for per-[svn-remote "..."] options
Eric Wong [Sun, 11 Feb 2007 08:51:33 +0000 (00:51 -0800)]
git-svn: add support for per-[svn-remote "..."] options

Available options are currently:

  svn-remote.<remote>.{noMetadata,useSvmProps,followParent}

These boolean switches will override options set globally in
[svn], and even override options set on the command-line (this
should probably change in the future, however).

Note that the noMetadata and useSvmProps options conflict.  It's
both technically and logically impossible to use them together.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add support for SVN::Mirror/svk using revprops for metadata
Eric Wong [Sun, 11 Feb 2007 04:46:50 +0000 (20:46 -0800)]
git-svn: add support for SVN::Mirror/svk using revprops for metadata

Pass --use-svm-props or set the svn.usesvmprops key with git-config
to enable using properties set by SVN::Mirror when it mirrored the
upstream URL.

This is heavily based on work from Sam Vilain:
> From: Sam Vilain <sam@vilain.net>
> Date: Sun, 11 Feb 2007 12:34:45 +1300
> Subject: [PATCH] git-svn: re-map repository URLs and UUIDs on SVK mirror paths
>
> If an SVN revision has a property, "svm:headrev", it is likely that
> the revision was created by SVN::Mirror (a part of SVK).  The property
> contains a repository UUID and a revision.  We want to make it look
> like we are mirroring the original URL, so introduce a helper function
> that returns the original identity URL and UUID, and use it when
> generating commit messages.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: remove optimized commit stuff for set-tree
Eric Wong [Sat, 10 Feb 2007 21:58:33 +0000 (13:58 -0800)]
git-svn: remove optimized commit stuff for set-tree

I may resurrect it for dcommit at some point, but nobody really
uses set-tree anymore and I don't feel like introducing more
complexity into the code at this point.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly handle globs with a right-hand-side path component
Eric Wong [Sat, 10 Feb 2007 21:28:50 +0000 (13:28 -0800)]
git-svn: correctly handle globs with a right-hand-side path component

Several bugs were found and fixed while getting this to work:

 * Remember the 'R'(eplace) case of actions and treat it like we
   would an 'A'(dd) case.

 * Fix a small case of follow-parent missing a parent if a
   subdirectory was modified in the revision where the parent was
   copied.

 * dirents returned by get_dir sometimes expire if the data
   structure is too big and the pool is destroyed, so we
   cache get_dir (along with check_path and get_revprops)
   temporarily along with its pool.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly handle the -q flag in SVN::Git::Fetcher
Eric Wong [Fri, 9 Feb 2007 20:23:47 +0000 (12:23 -0800)]
git-svn: correctly handle the -q flag in SVN::Git::Fetcher

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix buggy regular expression usage in several places
Eric Wong [Fri, 9 Feb 2007 20:17:57 +0000 (12:17 -0800)]
git-svn: fix buggy regular expression usage in several places

I incorrectly used $path/? and $path/* to strip off leading
directories, but places where $path = 'branches/0.17' would
incorrectly strip changes to 'branches/0.17.1' as well.

For globs, we require that our '*' is its own path component
(surrounded by '/' or nothing).  Enforce this when --prefix= is
passed to us, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: enable follow-parent functionality by default
Eric Wong [Fri, 9 Feb 2007 10:45:03 +0000 (02:45 -0800)]
git-svn: enable follow-parent functionality by default

--no-follow-parent disables and reverts it back to the old
default behavior of not following parents (if you don't care for
full history).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: remove some noisy debugging messages
Eric Wong [Fri, 9 Feb 2007 10:32:48 +0000 (02:32 -0800)]
git-svn: remove some noisy debugging messages

We don't need them anymore, all the rough points of
the --follow-parent implementation have been worked out.

The only improvement in the future will probably be
--follow-parent-harder, which will track subdirectories and
follow individual file history (so annotate/blame can be
complete); but that is still a ways off.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: remove check_path calls before calling do_update
Eric Wong [Fri, 9 Feb 2007 10:19:41 +0000 (02:19 -0800)]
git-svn: remove check_path calls before calling do_update

These checks were needed before git-svn got smarter about
match_paths() and using path information returned by get_log().
We also have extra checking against fetching revisions
out-of-order these days; so we don't have to worry about that as
much.  We also check for tree deletions in match_paths() and
skip those as well.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: --follow-parent tracks multi-parent paths
Eric Wong [Fri, 9 Feb 2007 09:28:30 +0000 (01:28 -0800)]
git-svn: --follow-parent tracks multi-parent paths

We can have a branch that was deleted, then re-added under the
same name but copied from another path, in which case we'll have
multiple parents (we don't want to break the original ref, nor
lose copypath info).

Add a test for this, too, of course.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: implement auto-discovery of branches/tags
Eric Wong [Thu, 8 Feb 2007 20:53:57 +0000 (12:53 -0800)]
git-svn: implement auto-discovery of branches/tags

This is similar to the way git proper handles refs, except we
use the keys 'branches' and 'tags' to distinguish when we want
to use wildcards.

The left-hand side of the ':' contains the remote path, and must
have one asterisk ('*') in it for the branch name.  The asterisk
may be in any component of the path as long as is it on its own
directory level.

The right-hand side contains the refname and must have the
asterisk as the last path component.

        branches = branches/*:refs/remotes/*
        tags = tags/*:refs/remotes/tags/*

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: run get_log() on a sub-directory if possible
Eric Wong [Wed, 7 Feb 2007 19:50:16 +0000 (11:50 -0800)]
git-svn: run get_log() on a sub-directory if possible

This is an optimization that should conserve network
bandwidth on certain repositories and configurations.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: reintroduce using a single get_log() to fetch
Eric Wong [Wed, 7 Feb 2007 02:35:30 +0000 (18:35 -0800)]
git-svn: reintroduce using a single get_log() to fetch

We'll need to rely on path matching to handle wildcard support for branches and
tags.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: prepare multi-init for wildcard support
Eric Wong [Sat, 3 Feb 2007 21:29:17 +0000 (13:29 -0800)]
git-svn: prepare multi-init for wildcard support

Update the tests since we no longer write so many things to the
config.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: just name the default svn-remote "svn" instead of "git-svn"
Eric Wong [Sat, 3 Feb 2007 20:49:48 +0000 (12:49 -0800)]
git-svn: just name the default svn-remote "svn" instead of "git-svn"

It can be confusing and redundant, since historically the
default remote ref (not remote itself) has been "git-svn", too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid extra get_log calls when refspecs are added for fetching
Eric Wong [Thu, 1 Feb 2007 12:26:00 +0000 (04:26 -0800)]
git-svn: avoid extra get_log calls when refspecs are added for fetching

Since fetch_loop_common starts from the lowest revision number
in a group of Git::SVN objects; we want to avoid refetching
get_log for current users for things we've already cut it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: get rid of revisions_eq check for --follow-parent
Eric Wong [Thu, 1 Feb 2007 12:12:41 +0000 (04:12 -0800)]
git-svn: get rid of revisions_eq check for --follow-parent

This was originally needed before we used the delta fetcher and
had a less-clean follow-parent implementation that could leave
holes in the history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: migrations default to [svn-remote "git-svn"]
Eric Wong [Thu, 1 Feb 2007 12:06:27 +0000 (04:06 -0800)]
git-svn: migrations default to [svn-remote "git-svn"]

It looks better (like [remote "origin"]) instead of whatever
refname came up first in our directory traversal.  Of course
--remote= overrides this.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: save paths to tags/branches with for future reuse
Eric Wong [Thu, 1 Feb 2007 11:59:07 +0000 (03:59 -0800)]
git-svn: save paths to tags/branches with for future reuse

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: don't write to the config file from --follow-parent
Eric Wong [Thu, 1 Feb 2007 11:30:31 +0000 (03:30 -0800)]
git-svn: don't write to the config file from --follow-parent

Having 'fetch' entries in the config file created from
--follow-parent is wasteful because it can cause *future* of
invocations to follow revisions we were never interested in
in the first place.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: use sys* IO functions for reading rev_db
Eric Wong [Thu, 1 Feb 2007 01:57:36 +0000 (17:57 -0800)]
git-svn: use sys* IO functions for reading rev_db

Using buffered IO for reading 40-41 bytes at a time isn't very
efficient.  Buffering writes for a short duration is alright
since we close() right away and buffers will be flushed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid redundant get_log calls between invocations
Eric Wong [Thu, 1 Feb 2007 01:22:31 +0000 (17:22 -0800)]
git-svn: avoid redundant get_log calls between invocations

Prefill .rev_db to the maximum revision we tried to fetch;
and take advantage of that so we can avoid using get_log()
on ranges we've already seen (and have deemed uninteresting).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: do our best to ensure that our ref and rev_db are consistent
Eric Wong [Wed, 31 Jan 2007 21:54:23 +0000 (13:54 -0800)]
git-svn: do our best to ensure that our ref and rev_db are consistent

Defer any signals that cause termination while they are
updating; and put the update-ref call as close to the rename()
as possible.  Also, make things extra-safe (but slower) for
people using --no-metadata since they can't rely on .rev_db
being rebuilt if it's clobbered (well, I'm calling update-ref
with the -m flag for reflogs, we don't yet have a way to rebuild
.rev_db from reflogs.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: re-enable repacking flags
Eric Wong [Wed, 31 Jan 2007 20:28:10 +0000 (12:28 -0800)]
git-svn: re-enable repacking flags

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid a huge memory spike with high-numbered revisions
Eric Wong [Wed, 31 Jan 2007 13:13:30 +0000 (05:13 -0800)]
git-svn: avoid a huge memory spike with high-numbered revisions

Passing very large strings as arguments is bad for memory usage
as it never seems to get freed in Perl.  The .rev_db format is
already not optimized for projects with sparse history.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: make (multi-)fetch safer but slower
Eric Wong [Tue, 30 Jan 2007 22:04:22 +0000 (14:04 -0800)]
git-svn: make (multi-)fetch safer but slower

get_log with explicit paths is the safest way to get revisions
that change a particular path we're interested in.
Unfortunately that means we still have to run get_log multiple
times for each path we're interested in, and even more if
a path gets deleted.

The first argument of get_log() is an array reference, but we
shouldn't use more than one element in that array ref because
the non-existence of _one_ of those paths for a particular range
would cause an error for all paths in that range, so yes, we
need multiple get_log calls to be on the safe side...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: gracefully handle --follow-parent failures
Eric Wong [Wed, 31 Jan 2007 11:45:28 +0000 (03:45 -0800)]
git-svn: gracefully handle --follow-parent failures

We don't always know that a path will exist at a particular
revision.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: reinstate --no-metadata, add --svn-remote=, variable cleanups
Eric Wong [Wed, 31 Jan 2007 11:06:56 +0000 (03:06 -0800)]
git-svn: reinstate --no-metadata, add --svn-remote=, variable cleanups

--svn-remote allows the default remote name to be overridden (useful
for tracking multiple SVN repositories).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix several fetch bugs related to repeated invocations
Eric Wong [Wed, 31 Jan 2007 10:45:50 +0000 (02:45 -0800)]
git-svn: fix several fetch bugs related to repeated invocations

We no longer delete the top-level directory even if it got
deleted from the upstream repository.  In gs_do_update; we
double-check that the path we're tracking exists at both
endpoints before proceeding.  We have also added additional
protection against fetching revisions out-of-order.

To simplify our internal interfaces, I've disabled passing the
'recursive' flag to the gs_do_{switch,update} wrapper functions
since we always want it in git-svn.  We also pass the
entire Git::SVN object rather than just the path because it
helped me debug.

When printing progress, the refname is printed out to make
it less confusing when multi-fetch is running.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: remove the 'rebuild' command and make the functionality automatic
Eric Wong [Tue, 30 Jan 2007 21:11:14 +0000 (13:11 -0800)]
git-svn: remove the 'rebuild' command and make the functionality automatic

Since refs/remotes/* are not automatically cloned, we expect the
user to be capable of copying those references themselves
anyways.

Also removed the documentation for --ignore-nodate while we're
at it; it has also been made automatic.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fetch tracks initial change with --follow-parent
Eric Wong [Tue, 30 Jan 2007 08:35:18 +0000 (00:35 -0800)]
git-svn: fetch tracks initial change with --follow-parent

We were still skipping path information from get_log if we are
tracking /r9270/drunk/subversion/bindings/..., but got something
like this in the log:

   A /r9270/drunk (from /r9270/trunk:14)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: don't rely on do_switch + reparenting with svn(+ssh)://
Eric Wong [Tue, 30 Jan 2007 03:16:01 +0000 (19:16 -0800)]
git-svn: don't rely on do_switch + reparenting with svn(+ssh)://

I can't seem to figure out what I or the SVN libraries are doing
wrong, but it appears to be related to reparent and probably
some global structure that gets reset if multiple SVN
connections are being used.

So now, in order to use do_switch; we'll open a new connection
to the repository with the complete URL; but we can't seem to
ever use an existing Ra object after another one has been
created...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: reinstate the default SVN error handler after using get_log
Eric Wong [Tue, 30 Jan 2007 02:34:55 +0000 (18:34 -0800)]
git-svn: reinstate the default SVN error handler after using get_log

We don't need our own error handler for other operations.  Also
add a message about the successfully do_switch or do_update in
follow-parent for debugging do_switch failures with svn:// and
svn+ssh:// connections.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: just use Digest::MD5 instead of requiring it
Eric Wong [Tue, 30 Jan 2007 00:27:08 +0000 (16:27 -0800)]
git-svn: just use Digest::MD5 instead of requiring it

Historically, git-svn did not always use Digest::MD5 because
it did not use the SVN::Delta::Editor interfaces.  Nowadays
it does, and the requires make strace more noisy.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: move editor-specific variables into the editor namespace
Eric Wong [Mon, 29 Jan 2007 08:07:49 +0000 (00:07 -0800)]
git-svn: cleanup: move editor-specific variables into the editor namespace

Also removed some unused/redundant functions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: stop using path names as refnames with --follow-parent
Eric Wong [Mon, 29 Jan 2007 05:34:23 +0000 (21:34 -0800)]
git-svn: stop using path names as refnames with --follow-parent

Using path names as refnames breaks horribly if a user is
tracking one large, toplevel directory, and a lower-level
directory is followed from another project is a parent
of another ref, as it will cause refnames such as:
'refs/remotes/trunk/path/to/stuff', which will conflict
with a refname of 'refs/remotes/trunk'.

Now we just append @$revno to the end of it the current
refname.  And if we have followed back to a grandparent, then
we'll strip any existing '@$parent_revno' strings before
appending our own '@$revno' string to it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly handle do_{switch,update} in deep directories
Eric Wong [Sun, 28 Jan 2007 12:59:05 +0000 (04:59 -0800)]
git-svn: correctly handle do_{switch,update} in deep directories

The do_update or do_switch functions in SVN only allow for a
single path component; so 'path/to/deep/dir' would be
interpreted as 'path'.

SVN 1.4.x has a reparent function that can let us change the
session to use a higher-level root of the repository, so we can
use that for do_switch (which still doesn't seem to work in SVN
1.4.3 (a fix was attempted, but they missed the rest of the
typemap changes needed in trunk...)).

On the do_update side, we can use set_path on higher level
directories and set them to a newer revision so they don't get
updated.  We can't do this with do_switch, either, because the
relative path we're tracking can change (directory moving into
a child of itself).

Because of these changes, we need to double check that our Fetch
editor is correctly performing stripping on any prefixed paths
from update, otherwise we'll just die() because that would be
a bug.

Added a test case which helped me notice and fix problems with
do_switch, too.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly track diff-less copies with do_switch
Eric Wong [Sun, 28 Jan 2007 12:02:01 +0000 (04:02 -0800)]
git-svn: correctly track diff-less copies with do_switch

Also, this should allow for the tracking of new, but empty
directories where we would want to see the log message.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow multi-fetch to fetch things chronologically
Eric Wong [Sun, 28 Jan 2007 06:28:56 +0000 (22:28 -0800)]
git-svn: allow multi-fetch to fetch things chronologically

Since single fetching is a special case of multi-fetch,
share code with it and the fetch loop into Git::SVN::Ra
since it uses a single Ra connection and multiple
Git::SVN objects.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup remove unused function
Eric Wong [Sat, 27 Jan 2007 22:38:10 +0000 (14:38 -0800)]
git-svn: cleanup remove unused function

Also move tz_to_s_offset into Git::SVN::Log since that's
the only place it's used now.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: simplify usage of the SVN::Git::Editor interface
Eric Wong [Sat, 27 Jan 2007 22:33:08 +0000 (14:33 -0800)]
git-svn: simplify usage of the SVN::Git::Editor interface

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid an extra svn_ra connection during commits
Eric Wong [Sat, 27 Jan 2007 09:32:00 +0000 (01:32 -0800)]
git-svn: avoid an extra svn_ra connection during commits

Before, we needed a separate svn_ra instance to run
our check_path calls once the editor was active; but
we can avoid that by running all the check_path calls
before our editor is active.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix committing to subdirectories, add tests
Eric Wong [Fri, 26 Jan 2007 09:32:45 +0000 (01:32 -0800)]
git-svn: fix committing to subdirectories, add tests

I broke this part with the URL minimization; since
git-svn will now try to connect to the root of
the repository and will end up writing files
there if it can...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix segfaults from accessing svn_log_changed_path_t
Eric Wong [Fri, 26 Jan 2007 01:35:40 +0000 (17:35 -0800)]
git-svn: fix segfaults from accessing svn_log_changed_path_t

svn_log_changed_path_t structs were being used out of scope
outside of svn_ra_get_log (because I wanted to eventually be
able to use git-svn with only a single connection to the
repository).  So now we dup them into a hash.

This was fixed while making --follow-parent fetches more
efficient.  I've moved parsing of the command-line --revision
argument outside of the Git::SVN module so Git::SVN::fetch() can
be used in more places (such as find_parent_branch).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: correctly track revisions made to deleted branches
Eric Wong [Thu, 25 Jan 2007 23:44:54 +0000 (15:44 -0800)]
git-svn: correctly track revisions made to deleted branches

git-svn has never been able to handle deleted branches very well
because svn_ra_get_log() is all-or-nothing, meaning that if the
max revision passed to it does not contain the path we're
tracking, we miss all the revisions in the repository.

Branches fetched using --follow-parent still do this
sub-optimally (will be fixed soon).  --follow-parent will soon
become the default, so we will assume that when using get_log();

We will also avoid tracking revprops for revisions with no
path-related changes since otherwise we just end up pulling
logs to paths we don't care about.

Also added a test for this to t9104-git-svn-follow-parent.sh and
correctly commit the log message in the preceeding test (which
conflicted with a filename).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: avoid tracking change-less revisions
Eric Wong [Thu, 25 Jan 2007 19:53:13 +0000 (11:53 -0800)]
git-svn: avoid tracking change-less revisions

They simply aren't interesting to track, and this will allow
us to avoid get_log().

Since r0 is covered by this, we need to update the tests to not
rely on r0 (which is always empty).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add an odd test case that seems to cause segfaults over HTTP
Eric Wong [Thu, 25 Jan 2007 18:52:36 +0000 (10:52 -0800)]
git-svn: add an odd test case that seems to cause segfaults over HTTP

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: track writes writes to the index in fetch
Eric Wong [Wed, 24 Jan 2007 11:30:57 +0000 (03:30 -0800)]
git-svn: track writes writes to the index in fetch

Introducing Git::IndexInfo.  This module will probably be useful
outside of git-svn, so I'm not putting it in the Git::SVN
namespace.

This will allow me to more easily avoid the use of get_log() in
the future and simply run do_update in incrementing ranges.
get_log() should be avoided because there are cases where
moved/deleted directories do not track correctly (until
--follow-parent is run on a new branch).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: --follow-parent now works on sub-directories of larger branches
Eric Wong [Wed, 24 Jan 2007 10:16:25 +0000 (02:16 -0800)]
git-svn: --follow-parent now works on sub-directories of larger branches

This means that tracking the path of:

  /another-larger/trunk/thunk/bump/thud inside a repository

would follow:

  /larger-parent/trunk/thunk/bump/thud

even if the svn log output looks like this:
  --------------------------------------------
  Changed paths:
     A /another-larger (from /larger-parent:5)
  --------------------------------------------

Note: the usage of get_log() in git-svn still makes a
an assumption that shouldn't be made with regard to
revisions existing for a particular path.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: 'init' attempts to connect to the repository root if possible
Eric Wong [Wed, 24 Jan 2007 00:29:23 +0000 (16:29 -0800)]
git-svn: 'init' attempts to connect to the repository root if possible

This allows connections to be used more efficiently and not require
users to run 'git-svn migrate --minimize' for new repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: better error reporting if --follow-parent fails
Eric Wong [Tue, 23 Jan 2007 21:03:29 +0000 (13:03 -0800)]
git-svn: better error reporting if --follow-parent fails

This will be useful to me when I try more special-cases
of parent-tracking.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow 'init' to work outside of tests
Eric Wong [Tue, 23 Jan 2007 19:35:53 +0000 (11:35 -0800)]
git-svn: allow 'init' to work outside of tests

Tests always ran 'git init' before we ran so that repo-config
would always have something to read.  However that does not work
in real-world situations where the user expects 'git svn init'
to work without running 'git init' first.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: get rid of additional fetch-arguments
Eric Wong [Mon, 22 Jan 2007 23:47:41 +0000 (15:47 -0800)]
git-svn: get rid of additional fetch-arguments

It's not really useful anymore now that we have a better
--follow-parent for the valid cases.  Any other use
of it is not valid.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: allow --follow-parent on deleted directories
Eric Wong [Mon, 22 Jan 2007 23:22:50 +0000 (15:22 -0800)]
git-svn: allow --follow-parent on deleted directories

Any operations on the index in Git::SVN that is not wrapped by
tmp_index_do() is wrong.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: disallow ambigious local refspecs
Eric Wong [Mon, 22 Jan 2007 21:52:04 +0000 (13:52 -0800)]
git-svn: disallow ambigious local refspecs

Having multiple fetch refspecs pointing to the same local ref
would be a very bad thing.  Start avoiding the use of fatal() or
exit() inside the modules so we can libify more easily.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: --follow-parent works with svn-remotes multiple branches
Eric Wong [Mon, 22 Jan 2007 19:44:57 +0000 (11:44 -0800)]
git-svn: --follow-parent works with svn-remotes multiple branches

Bugs fixed:

 * We didn't allow manually (not using git-svn) init-ed
   remotes/fetch refspecs to be used before.  It works now
   because that's what I did in this test.  git-svn init should
   offer more control in the future.
 * correctly strip paths in the delta editor when using
   do_switch().
 * Make the -i / GIT_SVN_ID option work correctly when doing
   fetch on a multi-ref svn-remote

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix --follow-parent to work with Git::SVN
Eric Wong [Mon, 22 Jan 2007 10:20:33 +0000 (02:20 -0800)]
git-svn: fix --follow-parent to work with Git::SVN

While we're at it, beef up the test because I was
getting false-passes during development.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: enable --minimize to simplify the config and connections
Eric Wong [Sun, 21 Jan 2007 12:27:09 +0000 (04:27 -0800)]
git-svn: enable --minimize to simplify the config and connections

--minimize will update the git-svn configuration to attempt to
connect to the repository root (instead of directly to the
path(s) we are tracking) in order to allow more efficient reuse
of connections (for multi-fetch and follow-parent).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: reuse open SVN::Ra connections by URL
Eric Wong [Fri, 19 Jan 2007 02:22:18 +0000 (18:22 -0800)]
git-svn: reuse open SVN::Ra connections by URL

Note: this can cause problems with Perl's reference counting GC,
so I'm disabling Git::SVN::Ra::DESTROY.  If we notice more
problems down the line, we can disable this enhancement.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fix a regression in dcommit that caused empty log messages
Eric Wong [Fri, 19 Jan 2007 02:15:23 +0000 (18:15 -0800)]
git-svn: fix a regression in dcommit that caused empty log messages

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add support for metadata in .git/config
Eric Wong [Fri, 19 Jan 2007 01:50:01 +0000 (17:50 -0800)]
git-svn: add support for metadata in .git/config

Of course, we handle metadata migrations from previous versions
and we have added unit tests.

The new .git/config remotes resemble non-SVN remotes.  Below
is an example with comments:

[svn-remote "git-svn"]
; like non-svn remotes, we have one URL per-remote
url = http://foo.bar.org/svn

; 'fetch' keys are done in the same way as non-svn
; remotes, too.  With the left-hand-side of the ':'
; being the remote (SVN) repository path relative to the
; above 'url' key; and the right-hand-side being a
; remote ref in git (refs/remotes/*).
; An empty left-hand-side means that it will fetch
; the entire contents of the 'url' key.
; old-style (migrated from previous versions of git-svn)
; are like this:
fetch = :refs/remotes/git-svn

; this is created by a current version of git-svn
; using the multi-init command with an explicit
; url (specified above).  This allows multi-init
; to reuse SVN::Ra connections.
fetch = trunk:refs/remotes/trunk
fetch = branches/a:refs/remotes/a
fetch = branches/b:refs/remotes/b
fetch = tags/0.1:refs/remotes/tags/0.1
fetch = tags/0.2:refs/remotes/tags/0.2
fetch = tags/0.3:refs/remotes/tags/0.3

[svn-remote "alt"]
; this is another old-style remote migrated over
; to the new config format
url = http://foo.bar.org/alt
fetch = :refs/remotes/alt

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: remove graft-branches command
Eric Wong [Tue, 16 Jan 2007 06:59:26 +0000 (22:59 -0800)]
git-svn: remove graft-branches command

It's becoming a maintenance burden.  I've never found it
particularly useful myself, nor have I heard much feedback about
it; so I'm assuming it's just as useless to everyone else.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert 'set-tree' command to use Git::SVN
Eric Wong [Mon, 15 Jan 2007 07:21:16 +0000 (23:21 -0800)]
git-svn: convert 'set-tree' command to use Git::SVN

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: switch dcommit to using Git::SVN code
Eric Wong [Sun, 14 Jan 2007 11:14:28 +0000 (03:14 -0800)]
git-svn: switch dcommit to using Git::SVN code

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: fetch/multi-fetch converted over to Git::SVN module
Eric Wong [Sun, 14 Jan 2007 10:17:00 +0000 (02:17 -0800)]
git-svn: fetch/multi-fetch converted over to Git::SVN module

--follow-parent and commit-diff are currently broken with
this commit...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: get rid of Memoize for now...
Eric Wong [Sun, 14 Jan 2007 07:00:47 +0000 (23:00 -0800)]
git-svn: get rid of Memoize for now...

I may refactor more of this stuff into separate modules

17 years agogit-svn: convert the 'commit-diff' command to Git::SVN
Eric Wong [Sun, 14 Jan 2007 06:35:53 +0000 (22:35 -0800)]
git-svn: convert the 'commit-diff' command to Git::SVN

Also, convert all usage of 'log_msg' to 'log_entry' for
consistency's sake

SVN::Git::Editor::apply_diff now drives the rest of the
editor.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: do not let Git.pm warn if we prematurely close pipes
Eric Wong [Fri, 12 Jan 2007 11:07:31 +0000 (03:07 -0800)]
git-svn: do not let Git.pm warn if we prematurely close pipes

This mainly quiets down warnings when running git svn log.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: port the 'rebuild' command to use Git::SVN objects
Eric Wong [Fri, 12 Jan 2007 10:49:01 +0000 (02:49 -0800)]
git-svn: port the 'rebuild' command to use Git::SVN objects

Also correctly shared some variables needed for Git::SVN::Log

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: moved the 'log' command into its own namespace
Eric Wong [Fri, 12 Jan 2007 10:35:20 +0000 (02:35 -0800)]
git-svn: moved the 'log' command into its own namespace

More cleanup to separate out functionality and make things
nicer to hack on.

While we're at it, centralize loading of the authors into
one place and correctly handle '(no author)' cases in
when showing logs after-the-fact; and not just at commit
time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert show-ignore over to Git::SVN
Eric Wong [Fri, 12 Jan 2007 01:58:39 +0000 (17:58 -0800)]
git-svn: convert show-ignore over to Git::SVN

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add a test for show-ignore
Eric Wong [Fri, 12 Jan 2007 01:55:50 +0000 (17:55 -0800)]
git-svn: add a test for show-ignore

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: make multi-init capable of reusing the Ra connection
Eric Wong [Fri, 12 Jan 2007 01:09:26 +0000 (17:09 -0800)]
git-svn: make multi-init capable of reusing the Ra connection

If a user specified a seperate URL and --tags/--branches as
a sepearte URL, allow the Ra object (and therefore the connection)
to be reused.

We'll get rid of libsvn_ls_fullurl() since it was only used
in one place.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert multi-init over to using Git::SVN
Eric Wong [Thu, 11 Jan 2007 23:35:55 +0000 (15:35 -0800)]
git-svn: convert multi-init over to using Git::SVN

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: convert 'init' to use Git::SVN
Eric Wong [Thu, 11 Jan 2007 20:26:16 +0000 (12:26 -0800)]
git-svn: convert 'init' to use Git::SVN

While we're at it, fix up some bugs in Git::SVN.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: add Git::SVN module (to avoid global variables)
Eric Wong [Thu, 11 Jan 2007 20:14:21 +0000 (12:14 -0800)]
git-svn: add Git::SVN module (to avoid global variables)

This should make it easier to improve multi-fetch and
--follow-parent by avoiding global variables.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: avoid re-use()ing Git.pm in sub-packages
Eric Wong [Thu, 11 Jan 2007 10:14:43 +0000 (02:14 -0800)]
git-svn: cleanup: avoid re-use()ing Git.pm in sub-packages

I will be using functions from Git.pm in more modules, so I
want to avoid re-importing the long argument list everywhere
it's used.

Also removed an unused command-line switch
(--no-ignore-externals) and some variables.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: put SVN workarounds into their own namespace
Eric Wong [Wed, 10 Jan 2007 09:22:38 +0000 (01:22 -0800)]
git-svn: cleanup: put SVN workarounds into their own namespace

Force some svn_ra functions to use a temporary pool via wrapper

This cleans up the code a bit by removing explicit instances of
pool allocation and deallocation and providing wrapper functions
that make use of temporary pools.

I've also added an explicit pool usage when creating the commit
editor for commit-diff where get_commit_editor can be called
multiple times with the same pool previously.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: cleanup: move process_rm around
Eric Wong [Thu, 4 Jan 2007 09:38:18 +0000 (01:38 -0800)]
git-svn: cleanup: move process_rm around

(it's only used in one function now)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agogit-svn: move authentication prompts into their own namespace
Eric Wong [Thu, 4 Jan 2007 08:45:03 +0000 (00:45 -0800)]
git-svn: move authentication prompts into their own namespace

I'm going to be reorganizing some more code.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
17 years agoMerge branches 'lt/crlf' and 'jc/apply-config'
Junio C Hamano [Fri, 23 Feb 2007 05:34:36 +0000 (21:34 -0800)]
Merge branches 'lt/crlf' and 'jc/apply-config'

* lt/crlf:
  Teach core.autocrlf to 'git apply'
  t0020: add test for auto-crlf
  Make AutoCRLF ternary variable.
  Lazy man's auto-CRLF

* jc/apply-config:
  t4119: test autocomputing -p<n> for traditional diff input.
  git-apply: guess correct -p<n> value for non-git patches.
  git-apply: notice "diff --git" patch again
  Fix botched "leak fix"
  t4119: add test for traditional patch and different p_value
  apply: fix memory leak in prefix_one()
  git-apply: require -p<n> when working in a subdirectory.
  git-apply: do not lose cwd when run from a subdirectory.
  Teach 'git apply' to look at $HOME/.gitconfig even outside of a repository
  Teach 'git apply' to look at $GIT_DIR/config

17 years agoMerge branch 'maint'
Junio C Hamano [Fri, 23 Feb 2007 05:27:37 +0000 (21:27 -0800)]
Merge branch 'maint'

* maint:
  git-diff: fix combined diff
  Fix 'git commit -a' in a newly initialized repository
  Include git-gui credits file in dist.
  Document the new core.bare configuration option.

17 years agogit-diff: fix combined diff
Johannes Schindelin [Fri, 23 Feb 2007 04:20:32 +0000 (05:20 +0100)]
git-diff: fix combined diff

The code forgets that typecast binds tighter than addition, in
other words:

    (cast *)array + i  === ((cast *)array) + i

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoFix 'git commit -a' in a newly initialized repository
Fredrik Kuivinen [Thu, 22 Feb 2007 20:28:12 +0000 (21:28 +0100)]
Fix 'git commit -a' in a newly initialized repository

With current git:

$ git init
$ git commit -a
cp: cannot stat `.git/index': No such file or directory

Output a nice error message instead.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoInclude git-gui credits file in dist.
Shawn O. Pearce [Thu, 22 Feb 2007 04:49:51 +0000 (23:49 -0500)]
Include git-gui credits file in dist.

The Makefile for the git-gui subproject will fail to execute if run
outside of a git.git directory, such as when building from a .tar.gz
or .tar.bz2.  This is because it is looking for the credits file,
which was created but omitted from the tarball by the toplevel
Makefile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agoDocument the new core.bare configuration option.
Shawn O. Pearce [Wed, 21 Feb 2007 22:59:08 +0000 (17:59 -0500)]
Document the new core.bare configuration option.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
17 years agot4119: test autocomputing -p<n> for traditional diff input.
Junio C Hamano [Thu, 22 Feb 2007 00:18:45 +0000 (16:18 -0800)]
t4119: test autocomputing -p<n> for traditional diff input.

Signed-off-by: Junio C Hamano <junkio@cox.net>