[PATCH 0 of 3] subrepo: fix diff/status -S of added/removed subrepo
Dov Feldstern
dovdevel at gmail.com
Wed May 16 16:46:57 CDT 2012
The problem statement: subrepo 'sub' containing a single file
'subfile' has been added to 'repo' sometime between rev1 and rev2:
rev1 rev2
------ ------
repo repo
+-- file +-- file
+-- sub
+-- subfile
I would expect:
$ hg status -S --rev rev1 --rev rev2
A .hgsub
A .hgsubstate
A sub/subfile
However, the actual output is:
A .hgsub
A .hgsubstate
with no mention of the contents of 'sub'. 'diff' behaves in the same
way.
Searching the bts, I found that this is issue 3056 [1]. That issue
seems to have culminated in a thread [2] in which everyone agrees that
the issue should be fixed, but that's where things were left.
So here are a few patches which solve the issue.
I've added some tests for this to test-subrepo.t. I've also fixed some
existing tests which inadvertently display this issue; note, though,
that not all cases covered by my new tests are covered by the existing
ones. If reducing the number of new tests is an issue, I would suggest
perhaps adding the new tests in exchange for removing the existing
tests for issue3153 [3] (which is actually a subset of issue3056)?
Finally, in reviewing these patches, I sort of feel that with a little
more refactoring --- something along the lines of having itersubrepos
also return the state of each subrepo in ctx2 --- things would be much
simpler from the caller's point of view; however, I'm not sure how
clean that is (it starts becoming hard to explain "what does
itersubrepos (and the more internal functions it calls) actually
do?"); and I wanted to get some feedback before venturing into more
serious refactoring.
Comments welcome.
[1] http://mercurial.selenic.com/bts/issue3056
[2] http://www.selenic.com/pipermail/mercurial-devel/2011-October/035194.html
[3] http://mercurial.selenic.com/bts/issue3153
More information about the Mercurial-devel
mailing list