# HG changeset patch # User Benoit Boissinot # Date 1220401645 -7200 # Node ID 2268edff1bec20c1f3ee4bdee43275a216287bc8 # Parent a3fd4aa154afff901779639df0963e4e2848b7dd allow committing a removed directory fix issue1089 diff -r a3fd4aa154af -r 2268edff1bec mercurial/cmdutil.py --- 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)): diff -r a3fd4aa154af -r 2268edff1bec tests/test-issue1089 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-issue1089 Wed Sep 03 02:27:25 2008 +0200 @@ -0,0 +1,17 @@ +#!/bin/sh + +hg init a +cd a +mkdir a +echo a > a/b +hg ci -Am m +hg rm a +hg ci -m m a + +mkdir a b +echo a > a/b +hg ci -Am m +hg rm a +cd b +# relative delete +hg ci -m m ../a diff -r a3fd4aa154af -r 2268edff1bec tests/test-issue1089.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-issue1089.out Wed Sep 03 02:27:25 2008 +0200 @@ -0,0 +1,4 @@ +adding a/b +removing a/b +adding a/b +removing a/b