##// END OF EJS Templates
bookmarks: accept explicit -r 'wdir()' when adding new bookmarks (issue6218)...
Yuya Nishihara -
r43999:a80d5dde default
parent child Browse files
Show More
@@ -958,8 +958,13 b' def addbookmarks(repo, tr, names, rev=No'
958 if rev:
958 if rev:
959 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
959 repo = scmutil.unhidehashlikerevs(repo, [rev], b'nowarn')
960
960
961 ctx = scmutil.revsingle(repo, rev)
961 ctx = scmutil.revsingle(repo, rev, None)
962 # bookmarking wdir means creating a bookmark on p1 and activating it
963 activatenew = not inactive and ctx.rev() is None
964 if ctx.node() is None:
965 ctx = ctx.p1()
962 tgt = ctx.node()
966 tgt = ctx.node()
967 assert tgt
963
968
964 for mark in names:
969 for mark in names:
965 mark = checkformat(repo, mark)
970 mark = checkformat(repo, mark)
@@ -984,7 +989,7 b' def addbookmarks(repo, tr, names, rev=No'
984 repo.ui.warn(b"(%s)\n" % msg)
989 repo.ui.warn(b"(%s)\n" % msg)
985
990
986 marks.applychanges(repo, tr, changes)
991 marks.applychanges(repo, tr, changes)
987 if not inactive and cur == marks[newact] and not rev:
992 if activatenew and cur == marks[newact]:
988 activate(repo, newact)
993 activate(repo, newact)
989 elif cur != tgt and newact == repo._activebookmark:
994 elif cur != tgt and newact == repo._activebookmark:
990 deactivate(repo)
995 deactivate(repo)
@@ -619,6 +619,16 b" deactivate current 'Z', but also add 'Y'"
619 x y 2:db815d6d32e6
619 x y 2:db815d6d32e6
620 $ hg bookmark Z
620 $ hg bookmark Z
621
621
622 bookmark wdir to activate it (issue6218)
623
624 $ hg bookmark -d Z
625 $ hg bookmark -r 'wdir()' Z
626 $ hg bookmark -l
627 X2 1:925d80f479bb
628 Y 2:db815d6d32e6
629 * Z 2:db815d6d32e6
630 x y 2:db815d6d32e6
631
622 test clone
632 test clone
623
633
624 $ hg bookmark -r 2 -i @
634 $ hg bookmark -r 2 -i @
General Comments 0
You need to be logged in to leave comments. Login now