Skip to contentSkip to conversation

git tool to keep a subversion mirror

PATCH New Sergey Yanovich 6 participants 24 messages Jun 15, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I am actively using git for my project. Thanks everyone envolved.

However, I got tired of administering own web server and registered my project at sourceforge. Unlike repo.or.cz (thanks again for everyone envolved), they do not provide git hosting. But a project without a source repository is non-sence.

I am not in any way going to use Subversion after I tried git, but I need to be able to export to a Subversion repository. I found an excellent tool called 'git-svn'. However, the flawed nature of Subversion put shackles on normal git usage after you do 'git-svn init'.

Since git is the best scm system, my situation is probably quite common. So I am filing these patches.

There is a 'git-svn' command which does want I need, so I created a simple wrapper around it. I also found that 'git-svn commit-diff' is having a small trouble dealing with root <tree-ish>, which is corrected by an attached patch.

#2 lore raw

PATCH 1/2 Accept root <tree-ish> in 'git-svn commit-diff'

---
 git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
git-svn.perl +8 -1
index 50128d7..8ad291b 100755
@@ -2572,7 +2572,12 @@ sub generate_diff {
 	}
 	push @diff_tree, '--find-copies-harder' if $_find_copies_harder;
 	push @diff_tree, "-l$_rename_limit" if defined $_rename_limit;
-	push @diff_tree, $tree_a, $tree_b;
+	if ($tree_a eq '0000000000000000000000000000000000000000') {
+		push @diff_tree, '--root';
+	} else {
+		push @diff_tree, $tree_a;
+	}
+	push @diff_tree, $tree_b;
 	my ($diff_fh, $ctx) = command_output_pipe(@diff_tree);
 	local $/ = "\0";
 	my $state = 'meta';
@@ -2606,6 +2611,8 @@ sub generate_diff {
 			}
 			$x->{file_b} = $_;
 			$state = 'meta';
+		} elsif ($state eq 'meta' && $_ eq $tree_b &&
+			$tree_a eq '0000000000000000000000000000000000000000') {
 		} else {
 			croak "Error parsing $_\n";
 		}
Signature · 1 line
1.5.2.1
#3 lore raw

PATCH 2/2 'git-svndump'

---
 Documentation/git-svndump.txt |  106 +++++++++++++++++++++++++++++++++++++++++
 git-svndump-init.sh           |   85 +++++++++++++++++++++++++++++++++
 git-svndump-sync.sh           |   85 +++++++++++++++++++++++++++++++++
 3 files changed, 276 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-svndump.txt
 create mode 100755 git-svndump-init.sh
 create mode 100755 git-svndump-sync.sh
Documentation/git-svndump.txt new file +106 -0
new file mode 100644
index 0000000..9caf02b
@@ -0,0 +1,106 @@
+git-svndump(1)
+==========
+
+NAME
+----
+git-svndump - Exporting from git to a single Subversion branch
+
+SYNOPSIS
+--------
+'git-svndump' <command> [options] [arguments]
+
+DESCRIPTION
+-----------
+git-svndump is essentially a wrapper around 'git-svn commit-diff'. It
+will work only when it is the sole method of committing to the
+Subversion repository.
+
+It is designed to export a linear git branch. However, thanks to the way
+'git' handles source code, 'git-svndump' seems to work in other
+conditions. For example, when branches are switched or merged.
+
+git-svndump provides a solution when you need to export you source code
+in Subversion format (who would need this with git :), but do not want
+to have all the shackles that 'git-svn init' puts on your repository.
+
+COMMANDS
+--------
+--
+
+'init'::
+	Initialize an existing git repository with additional
+	metadata directories for git-svndump.  The Subversion URL
+	must be specified as the first non-optional command-line
+	argument. 'git' tree-ish that correspond to the HEAD of
+	that Subversion URL may be specified as the second optional
+	command-line argument.
+
+-f;;
+	git-svndump normally declines to reinitialize the same git
+	repository. With the '-f' option that behavior is overridden.
+
+-A<filename>;;
+--authors-file=<filename>;;
+	The filename is stored, and provided as an argument to 'git-svn'
+	on calls of 'git-svndump sync'.
+
+'sync'::
+	Commit git revisions to the Subversion repository. If a git
+	<tree-ish> is specified as an optional command-line argument,
+	than all commits between the last 'sync' and that <tree-ish> are
+	send. If the argument is omitted, the HEAD of the active branch
+	is used.
+
+-A<filename>;;
+--authors-file=<filename>;;
+	The filename is provided as an argument to 'git-svn'.
+
+--
+
+BASIC EXAMPLE
+--------------
+
+Contributing to a Subversion repository:
+
+------------------------------------------------------------------------
+# Create your git repository, do some work and commit your  changes
+# You are working on a computer A (git.foo.org)
+# Prepare your git repository for export (you are in the top dir)
+	git-svndump-init -A .auth http://svn.foo.org/project
+# Commit the whole branch:
+	git-svndump-sync
+# Now you go a different computer B
+# Clone a git repo:
+	git clone git.foo.org:/path/to/project.git
+# Enter the newly cloned directory:
+	cd project
+# Immediately prepare the new repository for export
+	git-svndump-init -A .auth http://svn.foo.org/project HEAD
+# Do some work and commit both locally and to A:
+	git commit ...
+	git push
+# Commit the new work:
+	git-svndump-sync
+# Now you return to the computer A
+# Reinit your repository for export!
+	git-svndump-init -f -A .auth http://svn.foo.org/project HEAD
+------------------------------------------------------------------------
+
+BUGS
+----
+
+The HEAD of the Subversion repository is not tracked. If your
+git-svndump repository goes out-of-sync with the Subversion mirror,
+the latter will most probably be corrupted.
+
+SEE ALSO
+--------
+gitlink:git-svn[1]
+
+Author
+------
+Written by Sergey Yanovich <[email protected]>.
+
+Documentation
+-------------
+Written by Sergey Yanovich <[email protected]>.
git-svndump-init.sh new file +85 -0

85 lines not on this page · raw message

git-svndump-sync.sh new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.5.2.1
#4 lore raw

PATCH 3/3 Fix large-scale exports by 'git-svndump'

* Split revision list using 'tail' shell command.

* Wrap multiple list generation in an endless cycle with 'while true'. Exit from cycle when the current list is empty.

* Improve handling of merges by adding '--no-merges --topo-order'i arguments to the list generating command.

---
 git-svndump-sync.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
git-svndump-sync.sh +15 -1
index e1c04e1..516edaf 100755
@@ -70,7 +70,14 @@ if test -f $GIT_DIR/svndump/last ; then
 	fi
 fi
 
-list=`GIT_DIR=$GIT_DIR git-rev-list $commit $start`
+while true ; do
+
+list=`GIT_DIR=$GIT_DIR git-rev-list --no-merges --topo-order $commit $start |
+tail -n 8`
+
+if test -z "$list" ; then
+	exit 0
+fi
 
 diffs=""
 for c in $list ; do
@@ -79,7 +86,14 @@ done
 
 for c in $diffs ; do
 	GIT_DIR=$GIT_DIR git-svn commit-diff -r$rev $last $c $url
+	if test $? -ne 0 ; then
+		exit $?
+	fi
 	echo "$c" > $GIT_DIR/svndump/last
 	last=$c
 	let rev++
 done
+
+start=^$last
+
+done
Signature · 1 line
1.5.2.1
#6 lore raw
Quoted 2 lines · Sergey Yanovich

However, '--chain-reply-to' seems to have failed. The patches (2 of them) came as top-level posts. Or I may be doing something wrong.

I should have used '--thread' and '--in-reply-to=' when I was formating the patches. It should be correctied this time.

Sorry for being akward :)

--
Sergey Yanovich

#7 lore raw

PATCH 1/3 Accept root <tree-ish> in 'git-svn commit-diff'

---
 git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
git-svn.perl +8 -1
index 50128d7..8ad291b 100755
@@ -2572,7 +2572,12 @@ sub generate_diff {
 	}
 	push @diff_tree, '--find-copies-harder' if $_find_copies_harder;
 	push @diff_tree, "-l$_rename_limit" if defined $_rename_limit;
-	push @diff_tree, $tree_a, $tree_b;
+	if ($tree_a eq '0000000000000000000000000000000000000000') {
+		push @diff_tree, '--root';
+	} else {
+		push @diff_tree, $tree_a;
+	}
+	push @diff_tree, $tree_b;
 	my ($diff_fh, $ctx) = command_output_pipe(@diff_tree);
 	local $/ = "\0";
 	my $state = 'meta';
@@ -2606,6 +2611,8 @@ sub generate_diff {
 			}
 			$x->{file_b} = $_;
 			$state = 'meta';
+		} elsif ($state eq 'meta' && $_ eq $tree_b &&
+			$tree_a eq '0000000000000000000000000000000000000000') {
 		} else {
 			croak "Error parsing $_\n";
 		}
Signature · 1 line
1.5.2.1
#8 lore raw

PATCH 2/3 'git-svndump'

---
 Documentation/git-svndump.txt |  106 +++++++++++++++++++++++++++++++++++++++++
 git-svndump-init.sh           |   85 +++++++++++++++++++++++++++++++++
 git-svndump-sync.sh           |   85 +++++++++++++++++++++++++++++++++
 3 files changed, 276 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-svndump.txt
 create mode 100755 git-svndump-init.sh
 create mode 100755 git-svndump-sync.sh
Documentation/git-svndump.txt new file +106 -0
new file mode 100644
index 0000000..9caf02b
@@ -0,0 +1,106 @@
+git-svndump(1)
+==========
+
+NAME
+----
+git-svndump - Exporting from git to a single Subversion branch
+
+SYNOPSIS
+--------
+'git-svndump' <command> [options] [arguments]
+
+DESCRIPTION
+-----------
+git-svndump is essentially a wrapper around 'git-svn commit-diff'. It
+will work only when it is the sole method of committing to the
+Subversion repository.
+
+It is designed to export a linear git branch. However, thanks to the way
+'git' handles source code, 'git-svndump' seems to work in other
+conditions. For example, when branches are switched or merged.
+
+git-svndump provides a solution when you need to export you source code
+in Subversion format (who would need this with git :), but do not want
+to have all the shackles that 'git-svn init' puts on your repository.
+
+COMMANDS
+--------
+--
+
+'init'::
+	Initialize an existing git repository with additional
+	metadata directories for git-svndump.  The Subversion URL
+	must be specified as the first non-optional command-line
+	argument. 'git' tree-ish that correspond to the HEAD of
+	that Subversion URL may be specified as the second optional
+	command-line argument.
+
+-f;;
+	git-svndump normally declines to reinitialize the same git
+	repository. With the '-f' option that behavior is overridden.
+
+-A<filename>;;
+--authors-file=<filename>;;
+	The filename is stored, and provided as an argument to 'git-svn'
+	on calls of 'git-svndump sync'.
+
+'sync'::
+	Commit git revisions to the Subversion repository. If a git
+	<tree-ish> is specified as an optional command-line argument,
+	than all commits between the last 'sync' and that <tree-ish> are
+	send. If the argument is omitted, the HEAD of the active branch
+	is used.
+
+-A<filename>;;
+--authors-file=<filename>;;
+	The filename is provided as an argument to 'git-svn'.
+
+--
+
+BASIC EXAMPLE
+--------------
+
+Contributing to a Subversion repository:
+
+------------------------------------------------------------------------
+# Create your git repository, do some work and commit your  changes
+# You are working on a computer A (git.foo.org)
+# Prepare your git repository for export (you are in the top dir)
+	git-svndump-init -A .auth http://svn.foo.org/project
+# Commit the whole branch:
+	git-svndump-sync
+# Now you go a different computer B
+# Clone a git repo:
+	git clone git.foo.org:/path/to/project.git
+# Enter the newly cloned directory:
+	cd project
+# Immediately prepare the new repository for export
+	git-svndump-init -A .auth http://svn.foo.org/project HEAD
+# Do some work and commit both locally and to A:
+	git commit ...
+	git push
+# Commit the new work:
+	git-svndump-sync
+# Now you return to the computer A
+# Reinit your repository for export!
+	git-svndump-init -f -A .auth http://svn.foo.org/project HEAD
+------------------------------------------------------------------------
+
+BUGS
+----
+
+The HEAD of the Subversion repository is not tracked. If your
+git-svndump repository goes out-of-sync with the Subversion mirror,
+the latter will most probably be corrupted.
+
+SEE ALSO
+--------
+gitlink:git-svn[1]
+
+Author
+------
+Written by Sergey Yanovich <[email protected]>.
+
+Documentation
+-------------
+Written by Sergey Yanovich <[email protected]>.
git-svndump-init.sh new file +85 -0

85 lines not on this page · raw message

git-svndump-sync.sh new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.5.2.1
#9 lore raw

PATCH 3/3 Fix large-scale exports by 'git-svndump'

* Split revision list using 'tail' shell command.

* Wrap multiple list generation in an endless cycle with 'while true'. Exit from cycle when the current list is empty.

* Improve handling of merges by adding '--no-merges --topo-order'i arguments to the list generating command.

---
 git-svndump-sync.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
git-svndump-sync.sh +15 -1
index e1c04e1..516edaf 100755
@@ -70,7 +70,14 @@ if test -f $GIT_DIR/svndump/last ; then
 	fi
 fi
 
-list=`GIT_DIR=$GIT_DIR git-rev-list $commit $start`
+while true ; do
+
+list=`GIT_DIR=$GIT_DIR git-rev-list --no-merges --topo-order $commit $start |
+tail -n 8`
+
+if test -z "$list" ; then
+	exit 0
+fi
 
 diffs=""
 for c in $list ; do
@@ -79,7 +86,14 @@ done
 
 for c in $diffs ; do
 	GIT_DIR=$GIT_DIR git-svn commit-diff -r$rev $last $c $url
+	if test $? -ne 0 ; then
+		exit $?
+	fi
 	echo "$c" > $GIT_DIR/svndump/last
 	last=$c
 	let rev++
 done
+
+start=^$last
+
+done
Signature · 1 line
1.5.2.1
#10 lore raw

Re: [PATCH 3/3] Fix large-scale exports by 'git-svndump'

Quoted 8 lines · Sergey Yanovich

* Split revision list using 'tail' shell command.

* Wrap multiple list generation in an endless cycle with 'while true'. Exit from cycle when the current list is empty.

* Improve handling of merges by adding '--no-merges --topo-order'i arguments to the list generating command.

Please don't just repeat what can be seen in the patch anyway. Tell us what this is good for, and which problems it solves.

-- Hannes

#13 lore raw
Quoted 2 lines · Johannes Sixt

It is extremely difficult to tell whether the patch makes sense or is correct, if there is _no_ explanation what it is good for.

I agree 100%. I sent a fore-letter using git-send-email, but all parts got split.

Pasting it manually:

Quoted 19 lines

I am actively using git for my project. Thanks everyone envolved.

However, I got tired of administering own web server and registered my project at sourceforge. Unlike repo.or.cz (thanks again for everyone envolved), they do not provide git hosting. But a project without a source repository is non-sence.

I am not in any way going to use Subversion after I tried git, but I need to be able to export to a Subversion repository. I found an excellent tool called 'git-svn'. However, the flawed nature of Subversion put shackles on normal git usage after you do 'git-svn init'.

Since git is the best scm system, my situation is probably quite common. So I am filing these patches.

There is a 'git-svn' command which does want I need, so I created a simple wrapper around it. I also found that 'git-svn commit-diff' is having a small trouble dealing with root <tree-ish>, which is corrected by an attached patch.

#15 lore raw

PATCH 1/3 Accept root <tree-ish> in 'git-svn commit-diff'

In reply to Sergey Yanovich

Experiments with Subversion (my version is 1.4.2) show that it is not necessary to call 'svn import' before the first commit. Contrarily to the Subversion documentation, first commit may be done even when Subversion repository is at revision 0.

This allow export the whole git branch to a Subversion repo using only 'git-svn commit-diff'. Before this patch, however, 'git-svn' had no means to operate on root commits.

---
 git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
git-svn.perl +8 -1
index 50128d7..8ad291b 100755
@@ -2572,7 +2572,12 @@ sub generate_diff {
 	}
 	push @diff_tree, '--find-copies-harder' if $_find_copies_harder;
 	push @diff_tree, "-l$_rename_limit" if defined $_rename_limit;
-	push @diff_tree, $tree_a, $tree_b;
+	if ($tree_a eq '0000000000000000000000000000000000000000') {
+		push @diff_tree, '--root';
+	} else {
+		push @diff_tree, $tree_a;
+	}
+	push @diff_tree, $tree_b;
 	my ($diff_fh, $ctx) = command_output_pipe(@diff_tree);
 	local $/ = "\0";
 	my $state = 'meta';
@@ -2606,6 +2611,8 @@ sub generate_diff {
 			}
 			$x->{file_b} = $_;
 			$state = 'meta';
+		} elsif ($state eq 'meta' && $_ eq $tree_b &&
+			$tree_a eq '0000000000000000000000000000000000000000') {
 		} else {
 			croak "Error parsing $_\n";
 		}
Signature · 1 line
1.5.2.1
#16 lore raw

PATCH 2/3 'git-svndump'

A git tool to keep a subversion mirror

git-svndump is essentially a wrapper around 'git-svn commit-diff'. It will work only when it is the sole method of committing to the Subversion repository.

It is designed to export a linear git branch. However, thanks to the way 'git' handles source code, 'git-svndump' seems to work in other conditions. For example, when branches are switched or merged.

git-svndump provides a solution when you need to export your source code in Subversion format (who would need this with git :), but do not want to have all the shackles that 'git-svn init' puts on your repository.

---
 Documentation/git-svndump.txt |   97 ++++++++++++++++++++++++++++++++++++++++
 Makefile                      |    1 +
 git-svndump-init.sh           |   85 +++++++++++++++++++++++++++++++++++
 git-svndump-sync.sh           |   98 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-svndump.txt
 create mode 100755 git-svndump-init.sh
 create mode 100755 git-svndump-sync.sh
Documentation/git-svndump.txt new file +97 -0
new file mode 100644
index 0000000..11e7e79
@@ -0,0 +1,97 @@
+git-svndump(1)
+==========
+
+NAME
+----
+git-svndump - Exporting from git to a single Subversion branch
+
+SYNOPSIS
+--------
+'git-svndump' <command> [options] [arguments]
+
+DESCRIPTION
+-----------
+git-svndump is essentially a wrapper around 'git-svn commit-diff'. It
+will work only when it is the sole method of committing to the
+Subversion repository.
+
+It is designed to export a linear git branch. However, thanks to the way
+'git' handles source code, 'git-svndump' seems to work in other
+conditions. For example, when branches are switched or merged.
+
+git-svndump provides a solution when you need to export your source code
+in Subversion format (who would need this with git :), but do not want
+to have all the shackles that 'git-svn init' puts on your repository.
+
+COMMANDS
+--------
+--
+
+'init'::
+	Initialize an existing git repository with additional
+	metadata directories for git-svndump.  The Subversion URL
+	must be specified as the first non-optional command-line
+	argument. 'git' tree-ish that correspond to the HEAD of
+	that Subversion URL may be specified as the second optional
+	command-line argument.
+
+-f;;
+	git-svndump normally declines to reinitialize the same git
+	repository. With the '-f' option that behavior is overridden.
+
+'sync'::
+	Commit git revisions to the Subversion repository. If a git
+	<tree-ish> is specified as an optional command-line argument,
+	than all commits between the last 'sync' and that <tree-ish> are
+	send. If the argument is omitted, the HEAD of the active branch
+	is used.
+
+--
+
+BASIC EXAMPLE
+--------------
+
+Contributing to a Subversion repository:
+
+------------------------------------------------------------------------
+# Create your git repository, do some work and commit your  changes
+# You are working on a computer A (git.foo.org)
+# Prepare your git repository for export (you are in the top dir)
+	git-svndump-init -A .auth http://svn.foo.org/project
+# Commit the whole branch:
+	git-svndump-sync
+# Now you go a different computer B
+# Clone a git repo:
+	git clone git.foo.org:/path/to/project.git
+# Enter the newly cloned directory:
+	cd project
+# Immediately prepare the new repository for export
+	git-svndump-init -A .auth http://svn.foo.org/project HEAD
+# Do some work and commit both locally and to A:
+	git commit ...
+	git push
+# Commit the new work:
+	git-svndump-sync
+# Now you return to the computer A
+# Reinit your repository for export!
+	git-svndump-init -f -A .auth http://svn.foo.org/project HEAD
+------------------------------------------------------------------------
+
+BUGS
+----
+
+The HEAD of the Subversion repository is not tracked. If your
+git-svndump repository goes out-of-sync with the Subversion mirror,
+the latter will most probably be corrupted.
+
+SEE ALSO
+--------
+gitlink:git-svn[1]
+
+Author
+------
+Written by Sergey Yanovich <[email protected]>.
+
+Documentation
+-------------
+Written by Sergey Yanovich <[email protected]>.
Makefile +1 -0
index c09dfaf..ecf2803 100644
@@ -211,6 +211,7 @@ SCRIPT_SH = \
 	git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
 	git-merge-resolve.sh git-merge-ours.sh \
+	git-svndump-init.sh git-svndump-sync.sh \
 	git-lost-found.sh git-quiltimport.sh git-submodule.sh
 
 SCRIPT_PERL = \
git-svndump-init.sh new file +85 -0

85 lines not on this page · raw message

git-svndump-sync.sh new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
1.5.2.1
#17 lore raw

PATCH 3/3 Fix large-scale exports by 'git-svndump'

This is an empty patch. It is generated only to preserve headers ([PATCH x/y] ...) for two previous patches. May/should be ignored.

Thanks to Johannes Sixt <[email protected]> for comments.

---
 git-svndump-sync.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-svndump-sync.sh +1 -0
index 602af72..b3e47f9 100755
@@ -96,3 +96,4 @@ done
 start=^$last
 
 done
+
Signature · 1 line
1.5.2.1

A message that is not in the archive (sent off-list or not yet received): cff8d32813e43d9e1c75ad50824d95dbcd6f669c.1182235491.git.ynvich@gmail.com

#19 lore raw

Re: [PATCH 1/3] Accept root <tree-ish> in 'git-svn commit-diff'

Quoted 8 lines · Sergey Yanovich

Experiments with Subversion (my version is 1.4.2) show that it is not necessary to call 'svn import' before the first commit. Contrarily to the Subversion documentation, first commit may be done even when Subversion repository is at revision 0.

This allow export the whole git branch to a Subversion repo using only 'git-svn commit-diff'. Before this patch, however, 'git-svn' had no means to operate on root commits.

Cool.

Quoted 10 lines
---
 git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
git-svn.perl +0 -0
index 50128d7..8ad291b 100755

git-svn.perl sub generate_diff { · line 2575

Quoted 5 lines
git-svn.perl +1 -1
@@ -2572,7 +2572,12 @@ sub generate_diff {
 	}
 	push @diff_tree, '--find-copies-harder' if $_find_copies_harder;
 	push @diff_tree, "-l$_rename_limit" if defined $_rename_limit;
-	push @diff_tree, $tree_a, $tree_b;
+	if ($tree_a eq '0000000000000000000000000000000000000000') {

You can make this more legible by using '0' x40 instead of repeating 40 '0' characters. Also, it might be a good idea to support --root directly for git-svn so the user won't have to type 40 zeroes in the command-line :)

Quoted 9 lines
git-svn.perl +5 -0
+		push @diff_tree, '--root';
+	} else {
+		push @diff_tree, $tree_a;
+	}
+	push @diff_tree, $tree_b;
 	my ($diff_fh, $ctx) = command_output_pipe(@diff_tree);
 	local $/ = "\0";
 	my $state = 'meta';

git-svn.perl sub generate_diff { · line 2615

Quoted 5 lines
git-svn.perl +2 -0
@@ -2606,6 +2611,8 @@ sub generate_diff {
 			}
 			$x->{file_b} = $_;
 			$state = 'meta';
+		} elsif ($state eq 'meta' && $_ eq $tree_b &&
+			$tree_a eq '0000000000000000000000000000000000000000') {

Same here with '0' x40

Quoted 6 lines
git-svn.perl +0 -0
 		} else {
 			croak "Error parsing $_\n";
 		}
Signature · 1 line
1.5.2.1
Signature · 1 line
Eric Wong
#20 lore raw

Re: [PATCH 1/3] Accept root <tree-ish> in 'git-svn commit-diff'

Quoted 8 lines · Eric Wong

Review

Quoted 2 lines
(quoted diff) +1 -1
-	push @diff_tree, $tree_a, $tree_b;
+	if ($tree_a eq '0000000000000000000000000000000000000000') {

You can make this more legible by using '0' x40 instead of repeating 40 '0' characters. Also, it might be a good idea to support --root directly for git-svn so the user won't have to type 40 zeroes in the command-line :)

Sorry, I am not a perl expert or even user.

I did try to process '--root' in 'git-svn', but in vain. And I can explain, why 40 '0'. That is the only reference to root commit as an object that I managed to find in git - in the output of 'git-rev-list'.

If 40 '0' is not good, then it may worth to introduce a shorthand for it, just as we have one for 'HEAD'. 'NULL' or 'ROOT' may be. If this is implemented in 'git-rev-list', there will be no need to change 'git-svn' at all.

A message that is not in the archive (sent off-list or not yet received): 7d5543ebd8ac45e49a6d3f300e988189561512f1.1182235492.git.ynvich@gmail.com

#22 lore raw

Re: [PATCH 2/3] 'git-svndump'

Quoted 5 lines · Sergey Yanovich

A git tool to keep a subversion mirror

git-svndump is essentially a wrapper around 'git-svn commit-diff'. It will work only when it is the sole method of committing to the Subversion repository.

We could probably just implement this directly in git-svn. I'll try to find time to take a closer look at it this weekend or the next if I don't have time. If you or anybody else feel comfortable doing more work in Perl, feel free to go ahead with it.

Quoted 9 lines

It is designed to export a linear git branch. However, thanks to the way 'git' handles source code, 'git-svndump' seems to work in other conditions. For example, when branches are switched or merged.

git-svndump provides a solution when you need to export your source code in Subversion format (who would need this with git :), but do not want to have all the shackles that 'git-svn init' puts on your repository.

Quoted 9 lines
---
 Documentation/git-svndump.txt |   97 ++++++++++++++++++++++++++++++++++++++++
 Makefile                      |    1 +
 git-svndump-init.sh           |   85 +++++++++++++++++++++++++++++++++++
 git-svndump-sync.sh           |   98 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-svndump.txt
 create mode 100755 git-svndump-init.sh
 create mode 100755 git-svndump-sync.sh

I'm really not excited about having even more shell scripts in git.

Signature · 1 line
Eric Wong
#23 lore raw

Re: [PATCH 2/3] 'git-svndump'

Quoted 4 lines · Eric Wong

We could probably just implement this directly in git-svn. I'll try to find time to take a closer look at it this weekend or the next if I don't have time. If you or anybody else feel comfortable doing more work in Perl, feel free to go ahead with it.

I would be happy to help, but I don't speak fluent perl. I had real trouble introducing a global variable, when patching 'git-svn' for root commit.

Quoted 10 lines
Quoted 8 lines
 Documentation/git-svndump.txt |   97 ++++++++++++++++++++++++++++++++++++++++
 Makefile                      |    1 +
 git-svndump-init.sh           |   85 +++++++++++++++++++++++++++++++++++
 git-svndump-sync.sh           |   98 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-svndump.txt
 create mode 100755 git-svndump-init.sh
 create mode 100755 git-svndump-sync.sh

I'm really not excited about having even more shell scripts in git.

The first name for this scripts was 'git-svndumb'. They don't do anything themselves. They just call 'git-svn'. It works like decoupling in object-oriented design. Old UNIX philosophy of 'big number of small tools'.

If you decide to incorporate then in 'git-svn', you'll need to contaminate it with knowledge of 'svndumb'. I am afraid, you'll need to peruse the whole file, putting 'if's here and there.

But, it doesn't really matter, which you way you go. I would be happy just to see this functionality in some future release of git.

#24 lore raw
In reply to Matthieu Moy
Quoted 4 lines · Matthieu Moy
Quoted 1 line

which is corrected by an attached patch.

I believe you forgot it then ... ;-)

Absolutely right. Forgot to add a dir in the end. But I noticed that, and send a catch-up:

git-send-email --to git () vger . kernel.org --to normalperson () yhbt.net --chain-reply-to --subject "git tool to keep a subversion mirror" --compose --in-reply-to 11821061823423-git-send-email-ynvich () gmail.com /tmp/out/

Here, I replace @ with ' () ' in the above for some anti-bot protection.

However, '--chain-reply-to' seems to have failed. The patches (2 of them) came as top-level posts. Or I may be doing something wrong.

--
Sergey Yanovich

#25 lore raw
In reply to Sergey Yanovich
Quoted 6 lines · Sergey Yanovich

I am actively using git for my project. Thanks everyone envolved.

However, I got tired of administering own web server and registered my project at sourceforge. Unlike repo.or.cz (thanks again for everyone envolved), they do not provide git hosting. But a project without a source repository is non-sence.

It is. But project on sourceforge with source repository on repo.or.cz is perfectly ok.

Providing subversion interface to your project might make sense, but on the other hand you probably want your potential contributors make contributions with git and not with subversion.

As yet another alternative you might want to go to some other hosting. Maybe
http://en.wikipedia.org/wiki/Comparison_of_free_software_hosting_facilities
could be good starting point for looking for some.

Signature · 1 line
						 Jan 'Bulb' Hudec <[email protected]>