##// END OF EJS Templates
bookmarks: add support for `mirror` mode to `incoming`...
marmoute -
r49057:76c071bb default
parent child Browse files
Show More
@@ -791,7 +791,7 b' def updatefromremote('
791 791 repo._bookmarks.applychanges(repo, tr, changes)
792 792
793 793
794 def incoming(ui, repo, peer):
794 def incoming(ui, repo, peer, mode=None):
795 795 """Show bookmarks incoming from other to repo"""
796 796 ui.status(_(b"searching for changed bookmarks\n"))
797 797
@@ -805,9 +805,6 b' def incoming(ui, repo, peer):'
805 805 ).result()
806 806 )
807 807
808 r = comparebookmarks(repo, remotemarks, repo._bookmarks)
809 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
810
811 808 incomings = []
812 809 if ui.debugflag:
813 810 getid = lambda id: id
@@ -823,18 +820,36 b' def incoming(ui, repo, peer):'
823 820 def add(b, id, st):
824 821 incomings.append(b" %-25s %s\n" % (b, getid(id)))
825 822
826 for b, scid, dcid in addsrc:
827 # i18n: "added" refers to a bookmark
828 add(b, hex(scid), _(b'added'))
829 for b, scid, dcid in advsrc:
830 # i18n: "advanced" refers to a bookmark
831 add(b, hex(scid), _(b'advanced'))
832 for b, scid, dcid in diverge:
833 # i18n: "diverged" refers to a bookmark
834 add(b, hex(scid), _(b'diverged'))
835 for b, scid, dcid in differ:
836 # i18n: "changed" refers to a bookmark
837 add(b, hex(scid), _(b'changed'))
823 if mode == b'mirror':
824 localmarks = repo._bookmarks
825 allmarks = set(remotemarks.keys()) | set(localmarks.keys())
826 for b in sorted(allmarks):
827 loc = localmarks.get(b)
828 rem = remotemarks.get(b)
829 if loc == rem:
830 continue
831 elif loc is None:
832 add(b, hex(rem), _(b'added'))
833 elif rem is None:
834 add(b, hex(repo.nullid), _(b'removed'))
835 else:
836 add(b, hex(rem), _(b'changed'))
837 else:
838 r = comparebookmarks(repo, remotemarks, repo._bookmarks)
839 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
840
841 for b, scid, dcid in addsrc:
842 # i18n: "added" refers to a bookmark
843 add(b, hex(scid), _(b'added'))
844 for b, scid, dcid in advsrc:
845 # i18n: "advanced" refers to a bookmark
846 add(b, hex(scid), _(b'advanced'))
847 for b, scid, dcid in diverge:
848 # i18n: "diverged" refers to a bookmark
849 add(b, hex(scid), _(b'diverged'))
850 for b, scid, dcid in differ:
851 # i18n: "changed" refers to a bookmark
852 add(b, hex(scid), _(b'changed'))
838 853
839 854 if not incomings:
840 855 ui.status(_(b"no changed bookmarks found\n"))
@@ -4360,7 +4360,9 b' def incoming(ui, repo, source=b"default"'
4360 4360 ui.status(
4361 4361 _(b'comparing with %s\n') % urlutil.hidepassword(source)
4362 4362 )
4363 return bookmarks.incoming(ui, repo, other)
4363 return bookmarks.incoming(
4364 ui, repo, other, mode=path.bookmarks_mode
4365 )
4364 4366 finally:
4365 4367 other.close()
4366 4368
@@ -503,6 +503,26 b' mirroring bookmarks'
503 503 * foobar 1:9b140be10808
504 504 $ cp .hg/bookmarks .hg/bookmarks.bak
505 505 $ hg book -d X
506 $ hg incoming --bookmark -v ../a
507 comparing with ../a
508 searching for changed bookmarks
509 @ 0d2164f0ce0d diverged
510 X 0d2164f0ce0d added
511 $ hg incoming --bookmark -v ../a --config 'paths.*:bookmarks.mode=babar'
512 (paths.*:bookmarks.mode has unknown value: "babar")
513 comparing with ../a
514 searching for changed bookmarks
515 @ 0d2164f0ce0d diverged
516 X 0d2164f0ce0d added
517 $ hg incoming --bookmark -v ../a --config 'paths.*:bookmarks.mode=mirror'
518 comparing with ../a
519 searching for changed bookmarks
520 @ 0d2164f0ce0d changed
521 @foo 000000000000 removed
522 X 0d2164f0ce0d added
523 X@foo 000000000000 removed
524 foo 000000000000 removed
525 foobar 000000000000 removed
506 526 $ hg pull ../a --config 'paths.*:bookmarks.mode=mirror'
507 527 pulling from ../a
508 528 searching for changes
General Comments 0
You need to be logged in to leave comments. Login now