comparison mercurial/bookmarks.py @ 37641:add129811176

bookmarks: use command executor for wire protocol commands And change the name of a variable to reflect that is is a peer. Differential Revision: https://phab.mercurial-scm.org/D3292
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 13 Apr 2018 11:19:39 -0700
parents 81d35d5d35f9
children 8256962e798c
comparison
equal deleted inserted replaced
37640:ce8828217369 37641:add129811176
644 for b, node, writer, msg in sorted(changed): 644 for b, node, writer, msg in sorted(changed):
645 changes.append((b, node)) 645 changes.append((b, node))
646 writer(msg) 646 writer(msg)
647 localmarks.applychanges(repo, tr, changes) 647 localmarks.applychanges(repo, tr, changes)
648 648
649 def incoming(ui, repo, other): 649 def incoming(ui, repo, peer):
650 '''Show bookmarks incoming from other to repo 650 '''Show bookmarks incoming from other to repo
651 ''' 651 '''
652 ui.status(_("searching for changed bookmarks\n")) 652 ui.status(_("searching for changed bookmarks\n"))
653 653
654 remotemarks = unhexlifybookmarks(other.listkeys('bookmarks')) 654 with peer.commandexecutor() as e:
655 remotemarks = unhexlifybookmarks(e.callcommand('listkeys', {
656 'namespace': 'bookmarks',
657 }).result())
658
655 r = comparebookmarks(repo, remotemarks, repo._bookmarks) 659 r = comparebookmarks(repo, remotemarks, repo._bookmarks)
656 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r 660 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
657 661
658 incomings = [] 662 incomings = []
659 if ui.debugflag: 663 if ui.debugflag:
731 for s in sorted(outgoings): 735 for s in sorted(outgoings):
732 ui.write(s) 736 ui.write(s)
733 737
734 return 0 738 return 0
735 739
736 def summary(repo, other): 740 def summary(repo, peer):
737 '''Compare bookmarks between repo and other for "hg summary" output 741 '''Compare bookmarks between repo and other for "hg summary" output
738 742
739 This returns "(# of incoming, # of outgoing)" tuple. 743 This returns "(# of incoming, # of outgoing)" tuple.
740 ''' 744 '''
741 remotemarks = unhexlifybookmarks(other.listkeys('bookmarks')) 745 with peer.commandexecutor() as e:
746 remotemarks = unhexlifybookmarks(e.callcommand('listkeys', {
747 'namespace': 'bookmarks',
748 }).result())
749
742 r = comparebookmarks(repo, remotemarks, repo._bookmarks) 750 r = comparebookmarks(repo, remotemarks, repo._bookmarks)
743 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r 751 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
744 return (len(addsrc), len(adddst)) 752 return (len(addsrc), len(adddst))
745 753
746 def validdest(repo, old, new): 754 def validdest(repo, old, new):