Mercurial > hg-stable
diff mercurial/cmdutil.py @ 6980:2268edff1bec
allow committing a removed directory
fix issue1089
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 03 Sep 2008 02:27:25 +0200 |
parents | 63b5f4c73c98 |
children | b801d6e5dc83 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Sep 03 01:49:16 2008 +0200 +++ b/mercurial/cmdutil.py Wed Sep 03 02:27:25 2008 +0200 @@ -1155,6 +1155,12 @@ modified, added, removed = repo.status(match=m)[:3] files = util.sort(modified + added + removed) slist = None + + def is_dir(f): + name = f + '/' + i = bisect.bisect(files, name) + return i < len(files) and files[i].startswith(name) + for f in m.files(): if f == '.': continue @@ -1164,11 +1170,11 @@ try: mode = os.lstat(rf)[stat.ST_MODE] except OSError: + if is_dir(f): # deleted directory ? + continue raise util.Abort(_("file %s not found!") % rel) if stat.S_ISDIR(mode): - name = f + '/' - i = bisect.bisect(files, name) - if i >= len(files) or not files[i].startswith(name): + if not is_dir(f): raise util.Abort(_("no match under directory %s!") % rel) elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)):