Skip to content

Commit

Permalink
Merge git://git.bogomips.org/git-svn
Browse files Browse the repository at this point in the history
* git://git.bogomips.org/git-svn:
  git svn: Doc update for multiple branch and tag paths
  git svn: cleanup t9138-multiple-branches
  git-svn: Canonicalize svn urls to prevent libsvn assertion
  t9138: remove stray dot in test which broke bash
  git-svn: convert globs to regexps for branch destinations
  git svn: Support multiple branch and tag paths in the svn repository.
  Add 'git svn reset' to unwind 'git svn fetch'
  git-svn: speed up find_rev_before
  Add 'git svn help [cmd]' which works outside a repo.
  git-svn: let 'dcommit $rev' work on $rev instead of HEAD
  • Loading branch information
Junio C Hamano committed Jun 28, 2009
2 parents 36e74ab + ab81a36 commit 4f2b15c
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 42 deletions.
108 changes: 96 additions & 12 deletions Documentation/git-svn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ git-svn(1)

NAME
----
git-svn - Bidirectional operation between a single Subversion branch and git
git-svn - Bidirectional operation between a Subversion repository and git

SYNOPSIS
--------
Expand All @@ -15,13 +15,12 @@ DESCRIPTION
It provides a bidirectional flow of changes between a Subversion and a git
repository.

'git-svn' can track a single Subversion branch simply by using a
URL to the branch, follow branches laid out in the Subversion recommended
method (trunk, branches, tags directories) with the --stdlayout option, or
follow branches in any layout with the -T/-t/-b options (see options to
'init' below, and also the 'clone' command).
'git-svn' can track a standard Subversion repository,
following the common "trunk/branches/tags" layout, with the --stdlayout option.
It can also follow branches and tags in any layout with the -T/-t/-b options
(see options to 'init' below, and also the 'clone' command).

Once tracking a Subversion branch (with any of the above methods), the git
Once tracking a Subversion repository (with any of the above methods), the git
repository can be updated from Subversion by the 'fetch' command and
Subversion updated from git by the 'dcommit' command.

Expand All @@ -48,8 +47,11 @@ COMMANDS
--stdlayout;;
These are optional command-line options for init. Each of
these flags can point to a relative repository path
(--tags=project/tags') or a full url
(--tags=https://foo.org/project/tags). The option --stdlayout is
(--tags=project/tags) or a full url
(--tags=https://foo.org/project/tags).
You can specify more than one --tags and/or --branches options, in case
your Subversion repository places tags or branches under multiple paths.
The option --stdlayout is
a shorthand way of setting trunk,tags,branches as the relative paths,
which is the Subversion default. If any of the other options are given
as well, they take precedence.
Expand Down Expand Up @@ -170,8 +172,9 @@ and have no uncommitted changes.
It is recommended that you run 'git-svn' fetch and rebase (not
pull or merge) your commits against the latest changes in the
SVN repository.
An optional command-line argument may be specified as an
alternative to HEAD.
An optional revision or branch argument may be specified, and
causes 'git-svn' to do all work on that revision/branch
instead of HEAD.
This is advantageous over 'set-tree' (below) because it produces
cleaner, more linear history.
+
Expand Down Expand Up @@ -204,6 +207,20 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
Create a tag by using the tags_subdir instead of the branches_subdir
specified during git svn init.

-d;;
--destination;;
If more than one --branches (or --tags) option was given to the 'init'
or 'clone' command, you must provide the location of the branch (or
tag) you wish to create in the SVN repository. The value of this
option must match one of the paths specified by a --branches (or
--tags) option. You can see these paths with the commands
+
git config --get-all svn-remote.<name>.branches
git config --get-all svn-remote.<name>.tags
+
where <name> is the name of the SVN repository as specified by the -R option to
'init' (or "svn" by default).

'tag'::
Create a tag in the SVN repository. This is a shorthand for
'branch -t'.
Expand All @@ -215,7 +232,7 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
The following features from `svn log' are supported:
+
--
--revision=<n>[:<n>];;
-r/--revision=<n>[:<n>];;
is supported, non-numeric args are not:
HEAD, NEXT, BASE, PREV, etc ...
-v/--verbose;;
Expand Down Expand Up @@ -313,6 +330,63 @@ Any other arguments are passed directly to 'git-log'
Shows the Subversion externals. Use -r/--revision to specify a
specific revision.

'reset'::
Undoes the effects of 'fetch' back to the specified revision.
This allows you to re-'fetch' an SVN revision. Normally the
contents of an SVN revision should never change and 'reset'
should not be necessary. However, if SVN permissions change,
or if you alter your --ignore-paths option, a 'fetch' may fail
with "not found in commit" (file not previously visible) or
"checksum mismatch" (missed a modification). If the problem
file cannot be ignored forever (with --ignore-paths) the only
way to repair the repo is to use 'reset'.

Only the rev_map and refs/remotes/git-svn are changed. Follow 'reset'
with a 'fetch' and then 'git-reset' or 'git-rebase' to move local
branches onto the new tree.

-r/--revision=<n>;;
Specify the most recent revision to keep. All later revisions
are discarded.
-p/--parent;;
Discard the specified revision as well, keeping the nearest
parent instead.
Example:;;
Assume you have local changes in "master", but you need to refetch "r2".

------------
r1---r2---r3 remotes/git-svn
\
A---B master
------------

Fix the ignore-paths or SVN permissions problem that caused "r2" to
be incomplete in the first place. Then:

[verse]
git svn reset -r2 -p
git svn fetch

------------
r1---r2'--r3' remotes/git-svn
\
r2---r3---A---B master
------------

Then fixup "master" with 'git-rebase'.
Do NOT use 'git-merge' or your history will not be compatible with a
future 'dcommit'!

[verse]
git rebase --onto remotes/git-svn A^ master

------------
r1---r2'--r3' remotes/git-svn
\
A'--B' master
------------


--

OPTIONS
Expand Down Expand Up @@ -669,6 +743,16 @@ already dcommitted. It is considered bad practice to --amend commits
you've already pushed to a remote repository for other users, and
dcommit with SVN is analogous to that.

When using multiple --branches or --tags, 'git-svn' does not automatically
handle name collisions (for example, if two branches from different paths have
the same name, or if a branch and a tag have the same name). In these cases,
use 'init' to set up your git repository then, before your first 'fetch', edit
the .git/config file so that the branches and tags are associated with
different name spaces. For example:

branches = stable/*:refs/remotes/svn/stable/*
branches = debug/*:refs/remotes/svn/debug/*

BUGS
----

Expand Down
Loading

0 comments on commit 4f2b15c

Please sign in to comment.