Mercurial > hg-stable
changeset 9884:2dd700a35fd1
convert: make filemap favor most specific filtering rule
A filemap like:
exclude "doc"
include "doc/foo.txt"
will now preserve doc/foo.txt and exclude everything else in doc/.
author | Stefan Simek <simek@triaxis.sk> |
---|---|
date | Tue, 10 Nov 2009 13:04:03 +0100 |
parents | 0a8a43b4ca75 |
children | b1addc725998 |
files | hgext/convert/filemap.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/filemap.py Tue Nov 17 13:24:58 2009 +0100 +++ b/hgext/convert/filemap.py Tue Nov 10 13:04:03 2009 +0100 @@ -10,11 +10,11 @@ from common import SKIPREV, converter_source def rpairs(name): - yield '.', name e = len(name) while e != -1: yield name[:e], name[e+1:] e = name.rfind('/', 0, e) + yield '.', name class filemapper(object): '''Map and filter filenames when importing. @@ -82,7 +82,7 @@ exc = self.lookup(name, self.exclude)[0] else: exc = '' - if not inc or exc: + if (not self.include and exc) or (len(inc) <= len(exc)): return None newpre, pre, suf = self.lookup(name, self.rename) if newpre: