diff hgext/convert/monotone.py @ 8050:087cc65bebff

convert/mtn: record changes from directory renames (issue1587) Bug report and initial path by Pavel Volkovitskiy <int@mtx.ru>
author Patrick Mezard <pmezard@gmail.com>
date Sat, 11 Apr 2009 23:12:42 +0200
parents aa3f61884a48
children 718c8f01feb2 3cdf4872941a
line wrap: on
line diff
--- a/hgext/convert/monotone.py	Sat Apr 04 20:39:46 2009 -0500
+++ b/hgext/convert/monotone.py	Sat Apr 11 23:12:42 2009 +0200
@@ -111,12 +111,10 @@
     def mtnrenamefiles(self, files, fromdir, todir):
         renamed = {}
         for tofile in files:
-            suffix = tofile.lstrip(todir)
-            if todir + suffix == tofile:
-                renamed[tofile] = (fromdir + suffix).lstrip("/")
+            if tofile.startswith(todir + '/'):
+                renamed[tofile] = fromdir + tofile[len(todir):]
         return renamed
 
-
     # implement the converter_source interface:
 
     def getheads(self):
@@ -157,6 +155,7 @@
                     for tofile, fromfile in renamed.items():
                         self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") % (fromfile, tofile), '\n')
                         files[tofile] = rev
+                        copies[tofile] = fromfile
                     for fromfile in renamed.values():
                         files[fromfile] = rev
         return (files.items(), copies)