comparison mercurial/commands.py @ 18997:4cf09a1bf5b2

summary: clear "commonincoming" also if branches are different Before this patch, "commonincoming" calculated by "discovery.findcommonincoming()" is cleared, only if "default" URL without branch part (tail "#branch" of URL) differs from "default-push" URL without branch part. But common revisions in "commonincoming" calculated for a branch doesn't include ones for another branch, even if URLs without branch part are same. The result of "discovery.findcommonoutgoing()" invocation with such "commonincoming" becomes incorrect in some cases. This patch clears "commonincoming", also if branch part of "default" differs from one of "default-push". To avoid redundant looking up: - "ui.expandpath('default')" and "ui.expandpath('default-push', 'default')" are not compared directly, even though they contain branch information, because they are not yet normalized by "hg.parseurl()": tail "/" of path, for example - "commonincoming" is not cleared, if branch isn't specified in "default" URL, because such "commonincoming" contains common revisions for all branches This patch also tests "different path, same branch" pattern to check careless degrading around comparison between source and destination.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 09 Apr 2013 23:40:11 +0900
parents 160d8416e286
children 3af92401efb3
comparison
equal deleted inserted replaced
18996:160d8416e286 18997:4cf09a1bf5b2
5462 (new, len(bheads))) 5462 (new, len(bheads)))
5463 5463
5464 if opts.get('remote'): 5464 if opts.get('remote'):
5465 t = [] 5465 t = []
5466 source, branches = hg.parseurl(ui.expandpath('default')) 5466 source, branches = hg.parseurl(ui.expandpath('default'))
5467 sbranch = branches[0]
5467 other = hg.peer(repo, {}, source) 5468 other = hg.peer(repo, {}, source)
5468 revs, checkout = hg.addbranchrevs(repo, other, branches, 5469 revs, checkout = hg.addbranchrevs(repo, other, branches,
5469 opts.get('rev')) 5470 opts.get('rev'))
5470 if revs: 5471 if revs:
5471 revs = [other.lookup(rev) for rev in revs] 5472 revs = [other.lookup(rev) for rev in revs]
5476 repo.ui.popbuffer() 5477 repo.ui.popbuffer()
5477 if incoming: 5478 if incoming:
5478 t.append(_('1 or more incoming')) 5479 t.append(_('1 or more incoming'))
5479 5480
5480 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) 5481 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
5482 dbranch = branches[0]
5481 revs, checkout = hg.addbranchrevs(repo, repo, branches, None) 5483 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
5482 if source != dest: 5484 if source != dest:
5483 other = hg.peer(repo, {}, dest) 5485 other = hg.peer(repo, {}, dest)
5486 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5487 if (source != dest or (sbranch is not None and sbranch != dbranch)):
5484 commoninc = None 5488 commoninc = None
5485 ui.debug('comparing with %s\n' % util.hidepassword(dest))
5486 if revs: 5489 if revs:
5487 revs = [repo.lookup(rev) for rev in revs] 5490 revs = [repo.lookup(rev) for rev in revs]
5488 repo.ui.pushbuffer() 5491 repo.ui.pushbuffer()
5489 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs, 5492 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs,
5490 commoninc=commoninc) 5493 commoninc=commoninc)