summaryrefslogtreecommitdiff
path: root/contrib/remote-helpers
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2013-04-11 07:23:16 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-11 10:46:48 -0700
commit20c4b59c352529bda3f5d44baba5e393badc2ee8 (patch)
treeae245beb606297bedc5d4b3bc49c479b57e29029 /contrib/remote-helpers
parentremote-hg: document location of stored hg repository (diff)
downloadtgif-20c4b59c352529bda3f5d44baba5e393badc2ee8.tar.xz
remote-hg: fix bad file paths
Mercurial allows absolute file paths, and Git doesn't like that. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/remote-helpers')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 0db4ccae53..a5f0013c62 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -205,9 +205,15 @@ class Parser:
tz = ((tz / 100) * 3600) + ((tz % 100) * 60)
return (user, int(date), -tz)
+def fix_file_path(path):
+ if not os.path.isabs(path):
+ return path
+ return os.path.relpath(path, '/')
+
def export_file(fc):
d = fc.data()
- print "M %s inline %s" % (gitmode(fc.flags()), fc.path())
+ path = fix_file_path(fc.path())
+ print "M %s inline %s" % (gitmode(fc.flags()), path)
print "data %d" % len(d)
print d
@@ -401,7 +407,7 @@ def export_ref(repo, name, kind, head):
for f in modified:
export_file(c.filectx(f))
for f in removed:
- print "D %s" % (f)
+ print "D %s" % (fix_file_path(f))
print
count += 1