Mercurial > hg-stable
changeset 23081:e62c330a044f stable
bookmarks: explicitly track identical bookmarks
bookmarks.compare() previously lumped identical bookmarks in the
"invalid" bucket. This patch adds a "same" bucket.
An 8-tuple for holding this state is pretty gnarly. The return value
should probably be converted into a class to increase readability. But
that is beyond the scope of a patch intended to be a late arrival to
stable.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 24 Oct 2014 10:40:37 -0700 |
parents | c586cb50872b |
children | 0fc4686de1d7 |
files | mercurial/bookmarks.py mercurial/exchange.py |
diffstat | 2 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Fri Oct 24 15:52:20 2014 -0500 +++ b/mercurial/bookmarks.py Fri Oct 24 10:40:37 2014 -0700 @@ -271,6 +271,7 @@ :diverge: diverge :differ: changed, but changeset referred on src is unknown on dst :invalid: unknown on both side + :same: same on both side Each elements of lists in result tuple is tuple "(bookmark name, changeset ID on source side, changeset ID on destination @@ -299,12 +300,9 @@ else: srcmarkset = set(srcmarks) dstmarkset = set(dstmarks) - bset = srcmarkset ^ dstmarkset - for b in srcmarkset & dstmarkset: - if srchex(srcmarks[b]) != dsthex(dstmarks[b]): - bset.add(b) + bset = srcmarkset | dstmarkset - results = ([], [], [], [], [], [], []) + results = ([], [], [], [], [], [], [], []) addsrc = results[0].append adddst = results[1].append advsrc = results[2].append @@ -312,6 +310,7 @@ diverge = results[4].append differ = results[5].append invalid = results[6].append + same = results[7].append for b in sorted(bset): if b not in srcmarks: @@ -324,7 +323,9 @@ else: scid = srchex(srcmarks[b]) dcid = dsthex(dstmarks[b]) - if scid in repo and dcid in repo: + if scid == dcid: + same((b, scid, dcid)) + elif scid in repo and dcid in repo: sctx = repo[scid] dctx = repo[dcid] if sctx.rev() < dctx.rev(): @@ -365,7 +366,7 @@ def updatefromremote(ui, repo, remotemarks, path, trfunc, explicit=()): ui.debug("checking for updated bookmarks\n") localmarks = repo._bookmarks - (addsrc, adddst, advsrc, advdst, diverge, differ, invalid + (addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same ) = compare(repo, remotemarks, localmarks, dsthex=hex) status = ui.status
--- a/mercurial/exchange.py Fri Oct 24 15:52:20 2014 -0500 +++ b/mercurial/exchange.py Fri Oct 24 10:40:37 2014 -0700 @@ -333,7 +333,7 @@ explicit = set(pushop.bookmarks) comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex) - addsrc, adddst, advsrc, advdst, diverge, differ, invalid = comp + addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp for b, scid, dcid in advsrc: if b in explicit: explicit.remove(b)