changeset 6376:b40e90341ae2

convert: record deleted files in monotone source
author Patrick Mezard <pmezard@gmail.com>
date Mon, 24 Mar 2008 17:02:08 +0100
parents 31a01e3d99cc
children 2cf67d007f41
files hgext/convert/monotone.py tests/test-convert-mtn tests/test-convert-mtn.out
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/monotone.py	Mon Mar 24 16:20:15 2008 +0100
+++ b/hgext/convert/monotone.py	Mon Mar 24 17:02:08 2008 +0100
@@ -26,6 +26,7 @@
         self.add_file_re = re.compile(space + "add_file" + name + "content" + revision)
         self.patch_re    = re.compile(space + "patch" + name + "from" + revision + "to" + revision)
         self.rename_re   = re.compile(space + "rename" + name + "to" + name)
+        self.delete_re   = re.compile(space + "delete" + name)
         self.tag_re      = re.compile(space + "tag" + name + "revision" + revision)
         self.cert_re     = re.compile(lines + space + "name" + name + "value" + value)
 
@@ -137,6 +138,9 @@
             # Delete/rename is handled later when the convert engine
             # discovers an IOError exception from getfile,
             # but only if we add the "from" file to the list of changes.
+            m = self.delete_re.match(e)
+            if m:
+                files[m.group(1)] = rev
             m = self.rename_re.match(e)
             if m:
                 toname = m.group(2)
--- a/tests/test-convert-mtn	Mon Mar 24 16:20:15 2008 +0100
+++ b/tests/test-convert-mtn	Mon Mar 24 17:02:08 2008 +0100
@@ -69,7 +69,6 @@
 hg up -C
 glog
 echo % manifest
-# BUG: c and dir/b should not appear here
 hg manifest
 echo % contents
 cat dir/a
--- a/tests/test-convert-mtn.out	Mon Mar 24 16:20:15 2008 +0100
+++ b/tests/test-convert-mtn.out	Mon Mar 24 17:02:08 2008 +0100
@@ -32,18 +32,16 @@
 sorting...
 converting...
 0 update2
-5 files updated, 0 files merged, 0 files removed, 0 files unresolved
-@  2 "update2" files: bin bin2 e
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+@  2 "update2" files: bin bin2 dir/b e
 |
-o  1 "update1" files: a bin dir/a dir/b
+o  1 "update1" files: a bin c dir/a dir/b
 |
 o  0 "initialize" files: a bin c dir/b
 
 % manifest
 bin2
-c
 dir/a
-dir/b
 e
 % contents
 a