[PATCH STABLE] forget: show warning messages for forgetting in subrepo correctly
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Mon Feb 6 05:42:16 UTC 2012
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1328506669 -32400
# Branch stable
# Node ID 7fb2bbe270e83860186dff5a385c6d0a046abd5c
# Parent 7e5a281a082cdbff4ae9553e01b5ff36dc2c11ee
forget: show warning messages for forgetting in subrepo correctly
in 'cmdutil.forget()':
for f in match.files():
if match.exact(f) or not explicitonly:
....
is equal to:
for f in match.files():
if True:
....
because 'f' from 'match.files()' should 'match.exact(f)':
- 'match.files()' returns 'self._files'
- 'match.exact(f)' examines 'f in self._fmap',
- 'self._fmap' of match is 'set(self._files)'
then, 'explicitonly' wants to suppress warning messges, if it is true
(= 'cmdutil.forget()' is invoked from 'subrepo.forget()').
so, current code should be fixed as:
if not explicitonly:
for f in match.files():
....
diff -r 7e5a281a082c -r 7fb2bbe270e8 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py Fri Feb 03 19:47:09 2012 +0100
+++ b/mercurial/cmdutil.py Mon Feb 06 14:37:49 2012 +0900
@@ -1224,8 +1224,8 @@
ui.status(_("skipping missing subrepository: %s\n")
% join(subpath))
- for f in match.files():
- if match.exact(f) or not explicitonly:
+ if not explicitonly:
+ for f in match.files():
if f not in repo.dirstate and not os.path.isdir(match.rel(join(f))):
if f not in forgot:
if os.path.exists(match.rel(join(f))):
diff -r 7e5a281a082c -r 7fb2bbe270e8 tests/test-subrepo-recursion.t
--- a/tests/test-subrepo-recursion.t Fri Feb 03 19:47:09 2012 +0100
+++ b/tests/test-subrepo-recursion.t Mon Feb 06 14:37:49 2012 +0900
@@ -195,10 +195,14 @@
$ hg add foo/bar/z2.txt
$ hg status -S
A foo/bar/z2.txt
-This is expected to forget the file, but is currently broken
$ hg forget foo/bar/z2.txt
$ hg status -S
? foo/bar/z2.txt
+ $ hg forget foo/bar/z2.txt
+ not removing foo/bar/z2.txt: file is already untracked
+ [1]
+ $ hg status -S
+ ? foo/bar/z2.txt
$ rm foo/bar/z2.txt
Log with the relationships between repo and its subrepo:
More information about the Mercurial-devel
mailing list