Mercurial > hg
comparison mercurial/exchange.py @ 30583:8f8211903b83
bookmarks: make bookmarks.comparebookmarks accept binary nodes (API)
Binary bookmark format should be used internally. It doesn't make sense to have
optional parameters `srchex` and `dsthex`. This patch removes them. It will
also be useful for `bookmarks` bundle2 part because unnecessary conversions
between hex and bin nodes will be avoided.
author | Stanislau Hlebik <stash@fb.com> |
---|---|
date | Fri, 09 Dec 2016 03:22:26 -0800 |
parents | 94de83ed250e |
children | 95325386cd1a |
comparison
equal
deleted
inserted
replaced
30582:94de83ed250e | 30583:8f8211903b83 |
---|---|
601 remotebookmark = remote.listkeys('bookmarks') | 601 remotebookmark = remote.listkeys('bookmarks') |
602 | 602 |
603 explicit = set([repo._bookmarks.expandname(bookmark) | 603 explicit = set([repo._bookmarks.expandname(bookmark) |
604 for bookmark in pushop.bookmarks]) | 604 for bookmark in pushop.bookmarks]) |
605 | 605 |
606 comp = bookmod.comparebookmarks(repo, repo._bookmarks, | 606 remotebookmark = bookmod.unhexlifybookmarks(remotebookmark) |
607 remotebookmark, srchex=hex) | 607 comp = bookmod.comparebookmarks(repo, repo._bookmarks, remotebookmark) |
608 | |
609 def safehex(x): | |
610 if x is None: | |
611 return x | |
612 return hex(x) | |
613 | |
614 def hexifycompbookmarks(bookmarks): | |
615 for b, scid, dcid in bookmarks: | |
616 yield b, safehex(scid), safehex(dcid) | |
617 | |
618 comp = [hexifycompbookmarks(marks) for marks in comp] | |
608 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp | 619 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp |
620 | |
609 for b, scid, dcid in advsrc: | 621 for b, scid, dcid in advsrc: |
610 if b in explicit: | 622 if b in explicit: |
611 explicit.remove(b) | 623 explicit.remove(b) |
612 if not ancestors or repo[scid].rev() in ancestors: | 624 if not ancestors or repo[scid].rev() in ancestors: |
613 pushop.outbookmarks.append((b, dcid, scid)) | 625 pushop.outbookmarks.append((b, dcid, scid)) |
615 for b, scid, dcid in addsrc: | 627 for b, scid, dcid in addsrc: |
616 if b in explicit: | 628 if b in explicit: |
617 explicit.remove(b) | 629 explicit.remove(b) |
618 pushop.outbookmarks.append((b, '', scid)) | 630 pushop.outbookmarks.append((b, '', scid)) |
619 # search for overwritten bookmark | 631 # search for overwritten bookmark |
620 for b, scid, dcid in advdst + diverge + differ: | 632 for b, scid, dcid in list(advdst) + list(diverge) + list(differ): |
621 if b in explicit: | 633 if b in explicit: |
622 explicit.remove(b) | 634 explicit.remove(b) |
623 pushop.outbookmarks.append((b, dcid, scid)) | 635 pushop.outbookmarks.append((b, dcid, scid)) |
624 # search for bookmark to delete | 636 # search for bookmark to delete |
625 for b, scid, dcid in adddst: | 637 for b, scid, dcid in adddst: |
1454 if 'bookmarks' in pullop.stepsdone: | 1466 if 'bookmarks' in pullop.stepsdone: |
1455 return | 1467 return |
1456 pullop.stepsdone.add('bookmarks') | 1468 pullop.stepsdone.add('bookmarks') |
1457 repo = pullop.repo | 1469 repo = pullop.repo |
1458 remotebookmarks = pullop.remotebookmarks | 1470 remotebookmarks = pullop.remotebookmarks |
1471 remotebookmarks = bookmod.unhexlifybookmarks(remotebookmarks) | |
1459 bookmod.updatefromremote(repo.ui, repo, remotebookmarks, | 1472 bookmod.updatefromremote(repo.ui, repo, remotebookmarks, |
1460 pullop.remote.url(), | 1473 pullop.remote.url(), |
1461 pullop.gettransaction, | 1474 pullop.gettransaction, |
1462 explicit=pullop.explicitbookmarks) | 1475 explicit=pullop.explicitbookmarks) |
1463 | 1476 |