Bug in localrepository.changes( )
Goffredo Baroncelli
kreijack at libero.it
Fri Jul 1 17:11:50 CDT 2005
Hi,
I think that in localrepository.changes( ) there is a bug in the line 736:
the 'or' should be an 'and': otherwise if a file is changed in the wd _and_
between the 'tip' and the revision 'node1', the file is added two times to the 'c'
list.
Moreover for the same reason I think that few line below, we should add a check
to control if the file 'fn' is already in the liste 'a' ( think about a file
added and removed, then re-added in the working dir ... )
diff -r be6233a2bfdd mercurial/hg.py
--- a/mercurial/hg.py Fri Jul 1 19:49:58 2005
+++ b/mercurial/hg.py Fri Jul 1 23:47:35 2005
@@ -733,11 +733,12 @@
for fn in mf2:
if mf1.has_key(fn):
if mf1[fn] != mf2[fn]:
- if mf2[fn] != "" or fcmp(fn, mf1):
+ if mf2[fn] != "" and fcmp(fn, mf1):
c.append(fn)
del mf1[fn]
else:
- a.append(fn)
+ if not fn in a:
+ a.append(fn)
d = mf1.keys()
And sorry if I bother you, but I suggest to divide the function
changes() in three subfunction on the basis of the changes required:
- change between two revision in the repository
- change between the tip and the wd
- change between a revision and the working dir
Yes, I agree that there is a bit of code duplication; but so the function are more
little and more simple and more clear. This function isn't a rock science, but there is
a lot of corner cases which are better handled in different sub function
However now changes() is more clear than the old diffdir and pass my test script that
hilighted the bug which I emaild you.
Thank for your work
Goffredo
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack AT inwind DOT it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87 87C0 BB86 505C 6B2A CFF9
More information about the Mercurial
mailing list