[PATCH] Updated convert-repo script (1/3 Git 1.3.0 fix)

Thomas Arendsen Hein thomas at intevation.de
Sun May 14 12:34:45 CDT 2006


* Sébastien Pierre <sebastien at xprima.com> [20060502 21:39]:
> # HG changeset patch
> # User sebastien at localhost.localdomain
> # Node ID c2a90145c7034f4cd4d59092ffc76f65e83f3524
> # Parent  0ce3cd330996e49ac3292aac4bfa4d4cd3f0a47a
> Fixed the `getheads` function to work with git-1.3.0. I think this is
> backwards-compatible, but did not test with previous git versions.
> 
> diff -r 0ce3cd330996 -r c2a90145c703 contrib/convert-repo
> --- a/contrib/convert-repo	Fri Apr 28 12:38:11 2006 +0200
> +++ b/contrib/convert-repo	Mon May 01 16:50:04 2006 -0400
> @@ -28,7 +28,12 @@ class convert_git:
>          self.path = path
>  
>      def getheads(self):
> -        return [file(self.path + "/HEAD").read()[:-1]]
> +        # On some versions of git, the HEAD file last line is like
> +        # ref: refs/heads/master
> +        # And we only want "master" here
> +        head = file(self.path + "/HEAD").read()[:-1]
> +        head = head.split("/")[-1]
> +        return [head]
>  
>      def catfile(self, rev, type):
>          if rev == "0" * 40: raise IOError()

Can anyone confirm that this works with old and new git versions?
Then it can be pushed.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list