Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bug 821658, diff view should show files changed only on the second fo…

…rk, too
  • Loading branch information...
commit 084b098f7ff5dd5cb8162a66af60ac8b82a0cc29 1 parent 2f4ebf1
@Pike Pike authored
Showing with 27 additions and 3 deletions.
  1. +23 −1 apps/pushes/tests/test_diff.py
  2. +4 −2 apps/pushes/views/diff.py
View
24 apps/pushes/tests/test_diff.py
@@ -1069,6 +1069,8 @@ def setUp(self):
self.hgrepo = repository(self.ui, self.repo)
(open(self.hgrepo.pathto('file.dtd'), 'w')
.write(u'<!ENTITY key1 "Hello %d">\n' % self.edit))
+ (open(self.hgrepo.pathto('file2.dtd'), 'w')
+ .write(u'<!ENTITY key1 "Goodbye">\n'))
hgcommands.addremove(self.ui, self.hgrepo)
hgcommands.commit(self.ui, self.hgrepo,
user="Jane Doe <jdoe@foo.tld>",
@@ -1087,7 +1089,10 @@ def _exec_test(self, ctx1, ctx2):
logging.debug('anc files:\n%r', r[0].manifest().keys())
changed, added, removed, copies = v.processFork(r, ctx1, r, ctx2,
anc_rev)
- eq_((changed, added, removed), r.status(ctx1, ctx2)[:3])
+ ref_changed, ref_added, ref_removed = r.status(ctx1, ctx2)[:3]
+ logging.debug('hg changed, added, removed: %r',
+ (ref_changed, ref_added, ref_removed))
+ eq_((changed, added, removed), (ref_changed, ref_added, ref_removed))
eq_(copies, pathcopies(ctx1, ctx2))
def test_same_file_change(self):
@@ -1107,6 +1112,23 @@ def test_same_file_change(self):
ctx2 = self.hgrepo['tip']
self._exec_test(ctx1, ctx2)
+ def test_different_file_change(self):
+ rev0 = self.hgrepo[0].hex()
+ (open(self.hgrepo.pathto('file.dtd'), 'w')
+ .write(u'<!ENTITY key1 "Hello Again">\n'))
+ hgcommands.commit(self.ui, self.hgrepo,
+ user="Jane Doe <jdoe@foo.tld>",
+ message="first commit")
+ ctx1 = self.hgrepo['tip']
+ hgcommands.update(self.ui, self.hgrepo, rev=rev0)
+ (open(self.hgrepo.pathto('file2.dtd'), 'w')
+ .write(u'<!ENTITY key1 "Goodbye Again">\n'))
+ hgcommands.commit(self.ui, self.hgrepo,
+ user="Jane Doe <jdoe@foo.tld>",
+ message="second commit")
+ ctx2 = self.hgrepo['tip']
+ self._exec_test(ctx1, ctx2)
+
def test_same_file_rename(self):
rev0 = self.hgrepo[0].hex()
hgcommands.rename(self.ui, self.hgrepo,
View
6 apps/pushes/views/diff.py
@@ -216,9 +216,11 @@ def processFork(self, fromrepo, ctx1, torepo, ctx2, anc_rev):
# manifests in to and from match
m1 = m2 = None
changed = set(changed)
- more_changed = set(more_changed)
+ # only look at more_changed files we didn't add
+ more_changed = set(more_changed) - set(added)
both_changed = (changed & more_changed) | check_manifests
- changed |= both_changed
+ # changed may be anything changed first, second, or both
+ changed |= more_changed | check_manifests
for tp in both_changed:
fp = copies.get(tp, tp)
if m1 is None:
Please sign in to comment.
Something went wrong with that request. Please try again.