hefronmedia / pdfsizeopt

Automatically exported from code.google.com/p/pdfsizeopt
0 stars 0 forks source link

Migrate from SVN to Git #84

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Dear Peter,

As per your suggestion, I am opening this separate issue for dealing with a 
possible change from subversion to git (as that would make sending patches 
etc.) easier to contribute stuff.

Things like cherry-pick, bisect, automatic rebase, pull requests, send-email, 
format-patch etc. are so convenient to improve collaboration (the lasat ones 
even if we are sending "smoke signals", only having e-mail).

Furthermore, git, when used properly, keeps the credits by separating the 
author of a commit from the commiter, which is cool.

You have my offer to run a trivial `git svn clone` (that's actually what I am 
doing here at my end already).

Original issue reported on code.google.com by rbr...@gmail.com on 28 Feb 2013 at 11:20

GoogleCodeExporter commented 8 years ago
Thank you very much for recommending this. I anticipate that working with Git 
would be much easier, especially when accepting external contributions, and 
when backing up the repository to private servers (already done).

Migrating to Git was much easier than I anticipated.

First I did a `git svn clone' on trunk, then on wiki (because these are 
separate repositories in Google Code Git). Then I fixed the author and 
committer user names in e-mail addresses using

  git filter-branch -f --commit-filter 'GIT_COMMITTER_NAME="Peter Szabo"; GIT_COMMITTER_EMAIL="pts@fazekas.hu"; GIT_AUTHOR_NAME="$GIT_COMMITTER_NAME"; GIT_AUTHOR_EMAIL="$GIT_COMMITTER_EMAIL"; git commit-tree "$@"' HEAD

Then I pushed the button in the Administer panel of the project web UI, which 
changed the repository from SVN to Git. As a side effect, it wiped all SVN 
repository data, without asking for confirmation. This wasn't a problem, 
because I already had a copy made by `git svn clone'. Then I pushed from my 
local git repos:

  (cd pdfsizeopt && git push https://code.google.com/p/pdfsizeopt/ master)
  (cd pdfsizeopt.wiki && git push https://code.google.com/p/pdfsizeopt.wiki/ master)

Then I updated the /svn/trunk/ component in the download URLS to /git/ in the 
wiki:

  (cd pdfsizeopt.wiki && perl -pi -e 's@http://pdfsizeopt.googlecode.com/svn/trunk@http://pdfsizeopt.googlecode.com/git@g' *.wiki && git commit -a -m 'updated svn/trunk paths to git') && git push https://code.google.com/p/pdfsizeopt.wiki/ master)

... so the main download link became: 
http://pdfsizeopt.googlecode.com/git/pdfsizeopt.py

I also checked the project descriptions for links to update, but there weren't 
any.

Luckily, nothing else had to be changed: the issue tracker, the downloadable 
files and the project metadata remained intact.

Original comment by pts...@gmail.com on 8 Mar 2013 at 9:54

GoogleCodeExporter commented 8 years ago
That's great.

For future migrations, you can use

    git svn clone --authors-file=/tmp/authors.txt --no-metadata -s svn://foo/bar/

to clone a subversion repository that has the standard {branches,tags,trunk} 
layout without, and where `/tmp/authors.txt` contains only a single line:

    ptspts = Peter Szabo <pts@fazekas.hu>

If you wanted to clone just the trunk, just change remove the `-s` option from 
the clone command and put the suffix `trunk` on the "URL" of the svn repo.

Again, this is just a reference for the future, as the job is done now finished.

Thanks.

P.S.: Actually the svn repository may just be hidden, because I was able to 
update my git-svn repo with the revision 231.

Original comment by rbr...@gmail.com on 8 Mar 2013 at 12:06