Difference between revisions of "Reposurgeon"

From Freephile Wiki
Jump to navigation Jump to search
(more links)
(revert edits to fix search where character encoding was a problem)
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
[https://gitlab.com/esr/reposurgeon Reposurgeon] is a tool by Eric Raymond that is for editing version-control repositories.  It can be used to migrate from one system to another; like [[Git/migrating_to_git|migrating from Subversion to Git]].  A lot of large software projects <ref>e.g. [http://wiki.blender.org/index.php/Dev:Ref/Proposals/MigrationToGit Blender], [https://wiki.mozilla.org/ReleaseEngineering/How_To/VCSSync Mozilla], [http://esr.ibiblio.org/?p=4071 Network UPS Tools] </ref>have migrated from Subversion to Git, and reposurgeon is one of the few tools that can actually accomplish large migrations.
 
[https://gitlab.com/esr/reposurgeon Reposurgeon] is a tool by Eric Raymond that is for editing version-control repositories.  It can be used to migrate from one system to another; like [[Git/migrating_to_git|migrating from Subversion to Git]].  A lot of large software projects <ref>e.g. [http://wiki.blender.org/index.php/Dev:Ref/Proposals/MigrationToGit Blender], [https://wiki.mozilla.org/ReleaseEngineering/How_To/VCSSync Mozilla], [http://esr.ibiblio.org/?p=4071 Network UPS Tools] </ref>have migrated from Subversion to Git, and reposurgeon is one of the few tools that can actually accomplish large migrations.
 +
 +
[https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools#Interaction_with_other_Revision_Control_Systems There are many other tools] for importing and even bi-directional interfaces between repositories.  However, reposurgeon is probably the best tool for doing large complex migrations.
  
 
[http://esr.ibiblio.org/?p=4071 From January 2012]:
 
[http://esr.ibiblio.org/?p=4071 From January 2012]:
<blockquote>One of my requirements was that the user should not have to declare the branch structure! be able to read the detailed rules on reposurgeon 2.manual page; the short version is that if trunk is present, then trunk, branches/*, and tags/* are treated as candidate branches, and so is every other directory immediately under the repository root. But: a candidate branch is turned into a tag if there are no commits after the copy that created it.
+
<blockquote>One of my requirements was that the user should not have to declare the branch structure! You'll be able to read the detailed rules on reposurgeon 2.0's manual page; the short version is that if trunk is present, then trunk, branches/*, and tags/* are treated as candidate branches, and so is every other directory immediately under the repository root. But: a candidate branch is turned into a tag if there are no commits after the copy that created it.
 
</blockquote>
 
</blockquote>
  
Line 57: Line 59:
 
</source>
 
</source>
  
Why does reposurgeon generate .gitignore files<ref>http://www.catb.org/~esr/reposurgeon/dvcs-migration-guide.html</ref>?  Partly because it converts <code>svn:ignore</code> properties.  Partly because some tools (git-svn) introduce .gitignore files to the svn repo.  I also believe it may have to do with empty directory commits.<ref>https://stackoverflow.com/questions/22822020/convert-an-svn-repository-to-git-with-reposurgeon-without-creating-gitignore-fi</ref>
+
Why does reposurgeon generate .gitignore files<ref>http://www.catb.org/~esr/reposurgeon/dvcs-migration-guide.html</ref>?  Partly because it converts <code>svn:ignore</code> properties.  Partly because some tools ([[git-svn]]) introduce .gitignore files to the svn repo.  I also believe it may have to do with empty directory commits.<ref>https://stackoverflow.com/questions/22822020/convert-an-svn-repository-to-git-with-reposurgeon-without-creating-gitignore-fi</ref>
  
 
See below for a description of the <code>git filter-branch</code> command  
 
See below for a description of the <code>git filter-branch</code> command  
 +
 +
== Examples ==
 +
* http://blog.runtux.com/2014/04/18/233/
 +
* https://github.com/cmusatyalab/coda-git-conversion/blob/master/lwp.lift
  
 
== Re-writing history ==
 
== Re-writing history ==
Line 79: Line 85:
 
== Other ==  
 
== Other ==  
  
[https://svn.apache.org/repos/asf/subversion/trunk/contrib/server-side/svncutter/svncutter svncutter] is another tool, written in Python, by Eric Raymond.  svncutter is for stream surgery on SVN dump files.
+
* [https://svn.apache.org/repos/asf/subversion/trunk/contrib/server-side/svncutter/svncutter svncutter] is another tool, written in Python, by Eric Raymond.  svncutter is for stream surgery on SVN dump files.
 +
* [http://www.catb.org/~esr/reposurgeon/repopuller.html repopuller] comes with reposurgeon, and is a bash script for using <code>svnsync</code> to create a repo 'mirror' that can be used for reposurgery without having to hit the production repository.
  
 
{{References}}
 
{{References}}

Latest revision as of 07:40, 31 December 2018

Reposurgeon is a tool by Eric Raymond that is for editing version-control repositories. It can be used to migrate from one system to another; like migrating from Subversion to Git. A lot of large software projects [1]have migrated from Subversion to Git, and reposurgeon is one of the few tools that can actually accomplish large migrations.

There are many other tools for importing and even bi-directional interfaces between repositories. However, reposurgeon is probably the best tool for doing large complex migrations.

From January 2012:

One of my requirements was that the user should not have to declare the branch structure! You'll be able to read the detailed rules on reposurgeon 2.0's manual page; the short version is that if trunk is present, then trunk, branches/*, and tags/* are treated as candidate branches, and so is every other directory immediately under the repository root. But: a candidate branch is turned into a tag if there are no commits after the copy that created it.

Docs[edit | edit source]

  1. http://www.catb.org/~esr/reposurgeon
  2. http://www.catb.org/~esr/reposurgeon/features.html
  3. http://www.catb.org/~esr/reposurgeon/reposurgeon.html
  4. http://www.catb.org/~esr/reposurgeon/dvcs-migration-guide.html


Usage[edit | edit source]

Reposurgeon works in two modes: interactive, and scripted. The sample file below illustrates a scripted approach. You want to work on a complete (subversion) repo, not a working copy, so you either do a filesystem copy, or svnadmin dump first.


grundlett@hq-1:~$ cat bin/reposurgeon-myheart.sh

#!/bin/bash
PROJECT=myheart
svnrepo=file:///mount/data/repositories/$PROJECT
# or something like svnrepo=https://svn.example.com/$PROJECT

gitrepo=/tmp/$PROJECT-git

cd /tmp

# start over with:
#rm $PROJECT-mirror/ $PROJECT-git/ -Rf

echo
echo pull/copy the repository...
# repopuller $svnrepo
# or copy it if it is on the same server:
#cp -av /mount/data/repositories/$PROJECT /tmp/$PROJECT-mirror
echo
echo start conversion...

reposurgeon <<EOF
read /tmp/$PROJECT-mirror
prefer git
edit
references lift
rebuild $gitrepo
EOF
echo ...finished

# now filter out all falsely generated .gitignore files:
cd $gitrepo/
git filter-branch --force --index-filter      \
 "git rm --cached --ignore-unmatch $(find . -name .gitignore|xargs )"  \
 --prune-empty --tag-name-filter cat -- --all

Why does reposurgeon generate .gitignore files[2]? Partly because it converts svn:ignore properties. Partly because some tools (git-svn) introduce .gitignore files to the svn repo. I also believe it may have to do with empty directory commits.[3]

See below for a description of the git filter-branch command

Examples[edit | edit source]

Re-writing history[edit | edit source]

This content is probably best associated with Git, but deserves mention here since many migrations will involve manipulating history. With git, you can rewrite history using the filter-branch command

  • drop all empty changesets
    git filter-branch --commit-filter 'git_commit_non_empty_tree "$@"'
    

Verification[edit | edit source]

List branches sorted by date

git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/

Other[edit | edit source]

  • svncutter is another tool, written in Python, by Eric Raymond. svncutter is for stream surgery on SVN dump files.
  • repopuller comes with reposurgeon, and is a bash script for using svnsync to create a repo 'mirror' that can be used for reposurgery without having to hit the production repository.

References[edit source]