diff hgext/convert/git.py @ 25787:d9133e89d39d

convert: allow customizing git remote prefix Previously all git remotes were created as "remote/foo". This patch adds a configuration option for deciding what the prefix should be. This is useful if you want the bookmarks to be "origin/foo" like they are in git, or if you're integrating with the remotenames extension and don't want the local remote/foo bookmarks to overlap with the remote foo bookmarks.
author Durham Goode <durham@fb.com>
date Mon, 13 Jul 2015 21:37:46 -0700
parents f2748cc43b2a
children 80149d0b6842 d4e1e947444b
line wrap: on
line diff
--- a/hgext/convert/git.py	Sun Jul 12 17:59:25 2015 +0900
+++ b/hgext/convert/git.py	Mon Jul 13 21:37:46 2015 -0700
@@ -376,8 +376,9 @@
         prefixlen = len(prefix)
 
         # factor two commands
-        gitcmd = { 'remote/': 'git ls-remote --heads origin',
-                          '': 'git show-ref'}
+        remoteprefix = self.ui.config('convert', 'git.remoteprefix', 'remote')
+        gitcmd = { remoteprefix + '/': 'git ls-remote --heads origin',
+                                   '': 'git show-ref'}
 
         # Origin heads
         for reftype in gitcmd: