[PATCH] convert: support binary files, link to files (viceversa) in gnu arch

Aleix Conchillo Flaque aleix at member.fsf.org
Sat Feb 9 10:37:28 CST 2008


# HG changeset patch
# User Aleix Conchillo Flaque <aleix at member.fsf.org>
# Date 1202575002 -3600
# Node ID a3d8b1f8721df83ccc67a105718a0b7ee85d3f87
# Parent  e2cbdd93134105f9c11f05c6e2a4c32e5a0e6945
convert: support binary files, link to files (viceversa) in gnu arch

diff -r e2cbdd931341 -r a3d8b1f8721d hgext/convert/gnuarch.py
--- a/hgext/convert/gnuarch.py	Sat Feb 09 13:13:46 2008 +0100
+++ b/hgext/convert/gnuarch.py	Sat Feb 09 17:36:42 2008 +0100
@@ -246,31 +246,47 @@
     def _parsechangeset(self, data, rev):
         for l in data:
             l = l.strip()
+            # Added file (ignore added directory)
             if l.startswith('A') and not l.startswith('A/'):
                 file = l[1:].strip()
                 if not self._exclude(file):
                     self.changes[rev].add_files.append(file)
+            # Deleted file (ignore deleted directory)
+            elif l.startswith('D') and not l.startswith('D/'):
+                file = l[1:].strip()
+                if not self._exclude(file):
+                    self.changes[rev].del_files.append(file)
+            # Modified binary file
+            elif l.startswith('Mb'):
+                file = l[2:].strip()
+                if not self._exclude(file):
+                    self.changes[rev].mod_files.append(file)
+            # Modified link
+            elif l.startswith('M->'):
+                file = l[3:].strip()
+                if not self._exclude(file):
+                    self.changes[rev].mod_files.append(file)
+            # Modified file
+            elif l.startswith('M'):
+                file = l[1:].strip()
+                if not self._exclude(file):
+                    self.changes[rev].mod_files.append(file)
+            # Renamed file (or link)
+            elif l.startswith('=>'):
+                files = l[2:].strip().split(' ')
+                if len(files) == 1:
+                    files = l[2:].strip().split('\t')
+                if not self._exclude(files[0]) and not self._exclude(files[1]):
+                    self.changes[rev].ren_files[files[0]] = files[1]
+            # Conversion from file to link or from link to file (modified)
+            elif l.startswith('ch'):
+                file = l[2:].strip()
+                if not self._exclude(file):
+                    self.changes[rev].mod_files.append(file)
+            # Renamed directory
             elif l.startswith('/>'):
                 dirs = l[2:].strip().split(' ')
                 if len(dirs) == 1:
                     dirs = l[2:].strip().split('\t')
                 if not self._exclude(dirs[0]) and not self._exclude(dirs[1]):
                     self.changes[rev].ren_dirs[dirs[0]] = dirs[1]
-            elif l.startswith('M'):
-                file = l[1:].strip()
-                if not self._exclude(file):
-                    self.changes[rev].mod_files.append(file)
-            elif l.startswith('->'):
-                file = l[2:].strip()
-                if not self._exclude(file):
-                    self.changes[rev].mod_files.append(file)
-            elif l.startswith('D') and not l.startswith('D/'):
-                file = l[1:].strip()
-                if not self._exclude(file):
-                    self.changes[rev].del_files.append(file)
-            elif l.startswith('=>'):
-                files = l[2:].strip().split(' ')
-                if len(files) == 1:
-                    files = l[2:].strip().split('\t')
-                if not self._exclude(files[0]) and not self._exclude(files[1]):
-                    self.changes[rev].ren_files[files[0]] = files[1]


More information about the Mercurial-devel mailing list