Skip to content

Commit 4f2b15c

Browse files
committed
Merge git://git.bogomips.org/git-svn
* 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
2 parents 36e74ab + ab81a36 commit 4f2b15c

File tree

5 files changed

+446
-42
lines changed

5 files changed

+446
-42
lines changed

Documentation/git-svn.txt

Lines changed: 96 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ git-svn(1)
33

44
NAME
55
----
6-
git-svn - Bidirectional operation between a single Subversion branch and git
6+
git-svn - Bidirectional operation between a Subversion repository and git
77

88
SYNOPSIS
99
--------
@@ -15,13 +15,12 @@ DESCRIPTION
1515
It provides a bidirectional flow of changes between a Subversion and a git
1616
repository.
1717

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

24-
Once tracking a Subversion branch (with any of the above methods), the git
23+
Once tracking a Subversion repository (with any of the above methods), the git
2524
repository can be updated from Subversion by the 'fetch' command and
2625
Subversion updated from git by the 'dcommit' command.
2726

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

210+
-d;;
211+
--destination;;
212+
If more than one --branches (or --tags) option was given to the 'init'
213+
or 'clone' command, you must provide the location of the branch (or
214+
tag) you wish to create in the SVN repository. The value of this
215+
option must match one of the paths specified by a --branches (or
216+
--tags) option. You can see these paths with the commands
217+
+
218+
git config --get-all svn-remote.<name>.branches
219+
git config --get-all svn-remote.<name>.tags
220+
+
221+
where <name> is the name of the SVN repository as specified by the -R option to
222+
'init' (or "svn" by default).
223+
207224
'tag'::
208225
Create a tag in the SVN repository. This is a shorthand for
209226
'branch -t'.
@@ -215,7 +232,7 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
215232
The following features from `svn log' are supported:
216233
+
217234
--
218-
--revision=<n>[:<n>];;
235+
-r/--revision=<n>[:<n>];;
219236
is supported, non-numeric args are not:
220237
HEAD, NEXT, BASE, PREV, etc ...
221238
-v/--verbose;;
@@ -313,6 +330,63 @@ Any other arguments are passed directly to 'git-log'
313330
Shows the Subversion externals. Use -r/--revision to specify a
314331
specific revision.
315332

333+
'reset'::
334+
Undoes the effects of 'fetch' back to the specified revision.
335+
This allows you to re-'fetch' an SVN revision. Normally the
336+
contents of an SVN revision should never change and 'reset'
337+
should not be necessary. However, if SVN permissions change,
338+
or if you alter your --ignore-paths option, a 'fetch' may fail
339+
with "not found in commit" (file not previously visible) or
340+
"checksum mismatch" (missed a modification). If the problem
341+
file cannot be ignored forever (with --ignore-paths) the only
342+
way to repair the repo is to use 'reset'.
343+
344+
Only the rev_map and refs/remotes/git-svn are changed. Follow 'reset'
345+
with a 'fetch' and then 'git-reset' or 'git-rebase' to move local
346+
branches onto the new tree.
347+
348+
-r/--revision=<n>;;
349+
Specify the most recent revision to keep. All later revisions
350+
are discarded.
351+
-p/--parent;;
352+
Discard the specified revision as well, keeping the nearest
353+
parent instead.
354+
Example:;;
355+
Assume you have local changes in "master", but you need to refetch "r2".
356+
357+
------------
358+
r1---r2---r3 remotes/git-svn
359+
\
360+
A---B master
361+
------------
362+
363+
Fix the ignore-paths or SVN permissions problem that caused "r2" to
364+
be incomplete in the first place. Then:
365+
366+
[verse]
367+
git svn reset -r2 -p
368+
git svn fetch
369+
370+
------------
371+
r1---r2'--r3' remotes/git-svn
372+
\
373+
r2---r3---A---B master
374+
------------
375+
376+
Then fixup "master" with 'git-rebase'.
377+
Do NOT use 'git-merge' or your history will not be compatible with a
378+
future 'dcommit'!
379+
380+
[verse]
381+
git rebase --onto remotes/git-svn A^ master
382+
383+
------------
384+
r1---r2'--r3' remotes/git-svn
385+
\
386+
A'--B' master
387+
------------
388+
389+
316390
--
317391

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

746+
When using multiple --branches or --tags, 'git-svn' does not automatically
747+
handle name collisions (for example, if two branches from different paths have
748+
the same name, or if a branch and a tag have the same name). In these cases,
749+
use 'init' to set up your git repository then, before your first 'fetch', edit
750+
the .git/config file so that the branches and tags are associated with
751+
different name spaces. For example:
752+
753+
branches = stable/*:refs/remotes/svn/stable/*
754+
branches = debug/*:refs/remotes/svn/debug/*
755+
672756
BUGS
673757
----
674758

0 commit comments

Comments
 (0)