##// 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,18 +820,36 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
826 for b, scid, dcid in addsrc:
823 if mode == b'mirror':
827 # i18n: "added" refers to a bookmark
824 localmarks = repo._bookmarks
828 add(b, hex(scid), _(b'added'))
825 allmarks = set(remotemarks.keys()) | set(localmarks.keys())
829 for b, scid, dcid in advsrc:
826 for b in sorted(allmarks):
830 # i18n: "advanced" refers to a bookmark
827 loc = localmarks.get(b)
831 add(b, hex(scid), _(b'advanced'))
828 rem = remotemarks.get(b)
832 for b, scid, dcid in diverge:
829 if loc == rem:
833 # i18n: "diverged" refers to a bookmark
830 continue
834 add(b, hex(scid), _(b'diverged'))
831 elif loc is None:
835 for b, scid, dcid in differ:
832 add(b, hex(rem), _(b'added'))
836 # i18n: "changed" refers to a bookmark
833 elif rem is None:
837 add(b, hex(scid), _(b'changed'))
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 if not incomings:
854 if not incomings:
840 ui.status(_(b"no changed bookmarks found\n"))
855 ui.status(_(b"no changed bookmarks found\n"))
@@ -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