##// 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 repo._bookmarks.applychanges(repo, tr, changes)
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 """Show bookmarks incoming from other to repo"""
795 """Show bookmarks incoming from other to repo"""
796 ui.status(_(b"searching for changed bookmarks\n"))
796 ui.status(_(b"searching for changed bookmarks\n"))
797
797
@@ -805,9 +805,6 b' def incoming(ui, repo, peer):'
805 ).result()
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 incomings = []
808 incomings = []
812 if ui.debugflag:
809 if ui.debugflag:
813 getid = lambda id: id
810 getid = lambda id: id
@@ -823,6 +820,24 b' def incoming(ui, repo, peer):'
823 def add(b, id, st):
820 def add(b, id, st):
824 incomings.append(b" %-25s %s\n" % (b, getid(id)))
821 incomings.append(b" %-25s %s\n" % (b, getid(id)))
825
822
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
826 for b, scid, dcid in addsrc:
841 for b, scid, dcid in addsrc:
827 # i18n: "added" refers to a bookmark
842 # i18n: "added" refers to a bookmark
828 add(b, hex(scid), _(b'added'))
843 add(b, hex(scid), _(b'added'))
@@ -4360,7 +4360,9 b' def incoming(ui, repo, source=b"default"'
4360 ui.status(
4360 ui.status(
4361 _(b'comparing with %s\n') % urlutil.hidepassword(source)
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 finally:
4366 finally:
4365 other.close()
4367 other.close()
4366
4368
@@ -503,6 +503,26 b' mirroring bookmarks'
503 * foobar 1:9b140be10808
503 * foobar 1:9b140be10808
504 $ cp .hg/bookmarks .hg/bookmarks.bak
504 $ cp .hg/bookmarks .hg/bookmarks.bak
505 $ hg book -d X
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 $ hg pull ../a --config 'paths.*:bookmarks.mode=mirror'
526 $ hg pull ../a --config 'paths.*:bookmarks.mode=mirror'
507 pulling from ../a
527 pulling from ../a
508 searching for changes
528 searching for changes
General Comments 0
You need to be logged in to leave comments. Login now