[PATCH] convert filemap: don't exclude path if more specific include path exists

Adam Souzis adamsz at gmail.com
Thu Feb 12 14:45:18 CST 2009


hi,

Currently, if you use the convert extension with a filemap that looks like this:

exclude A
include A/B

The include line will be ignored and A/B will be excluded. With this
patch A/B will be included:

# HG changeset patch
# User adam at souzis.com
# Date 1234470760 28800
# Node ID 4d664b8ae569dc60fe27294c3a88a9319ffde2f2
# Parent  5a6f417fa0290f8e7c69fc79c8da438b62dc7c9b
convert filemap: don't exclude path if more specific include path exists

diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py
--- a/hgext/convert/filemap.py
+++ b/hgext/convert/filemap.py
@@ -82,7 +82,12 @@
             exc = self.lookup(name, self.exclude)[0]
         else:
             exc = ''
-        if not inc or exc:
+        if inc and exc and self.include:
+            #both match, so only exclude if the exclude match is longer
+            #(more specific) than the include match
+            if len(exc) > len(inc):
+                return None
+        elif not inc or exc:
             return None
         newpre, pre, suf = self.lookup(name, self.rename)
         if newpre:


More information about the Mercurial-devel mailing list