comparison tests/test-bookmarks.t @ 27948:7cb7264cfd52 stable

commands: advance current active bookmark at pull --update correctly Before this patch, "hg pull --update" doesn't advance current active bookmark correctly, if pulling itself doesn't advance it, even though "hg pull" + "hg update" does so. Existing test for "pull --update works the same as pull && update" in test-bookmarks.t doesn't examine this case, because pulling itself advance current active bookmark before actual updating the working directory in that test case. To advance current active bookmark at "hg pull --update" correctly, this patch examines 'movemarkfrom' instead of 'not checkout'. Even if 'not checkout' at the invocation of postincoming(), 'checkout' is overwritten by "the revision to update to" value returned by destutil.destupdate() in such case. Therefore, 'not checkout' condition means "update destination is revision #0", and isn't suitable for examining whether active bookmark should be advanced. Even though examination around "movemarkfrom == repo['.'].node()" may seem a little redundant just for this issue, this makes it easier to compare (and unify in the future, maybe) with the same logic to update bookmark at "hg update" below. if not ret and movemarkfrom: if movemarkfrom == repo['.'].node(): pass # no-op update elif bookmarks.update(repo, [movemarkfrom], repo['.'].node()): ui.status(_("updating bookmark %s\n") % repo._activebookmark) else: # this can happen with a non-linear update ui.status(_("(leaving bookmark %s)\n") % repo._activebookmark) bookmarks.deactivate(repo)
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 28 Jan 2016 20:10:06 +0900
parents 71a485130beb
children 72072cfc7e91
comparison
equal deleted inserted replaced
27947:571ba161f6be 27948:7cb7264cfd52
779 foo 3:9ba5f110a0b3 779 foo 3:9ba5f110a0b3
780 foo@1 0:f7b1eb17ad24 780 foo@1 0:f7b1eb17ad24
781 foo@2 2:db815d6d32e6 781 foo@2 2:db815d6d32e6
782 four 3:9ba5f110a0b3 782 four 3:9ba5f110a0b3
783 should-end-on-two 2:db815d6d32e6 783 should-end-on-two 2:db815d6d32e6
784
785 pull --update works the same as pull && update (case #2)
786
787 It is assumed that "hg pull" itself doesn't update current active
788 bookmark ('Y' in tests below).
789
790 $ hg pull -q ../cloned-bookmarks-update
791 divergent bookmark Z stored as Z@2
792
793 (pulling revision on another named branch with --update updates
794 neither the working directory nor current active bookmark: "no-op"
795 case)
796
797 $ echo yy >> y
798 $ hg commit -m yy
799
800 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
801 * Y 3:125c9a1d6df6
802 $ hg -R ../cloned-bookmarks-update pull . --update
803 pulling from .
804 searching for changes
805 adding changesets
806 adding manifests
807 adding file changes
808 added 1 changesets with 1 changes to 1 files
809 divergent bookmark Z stored as Z@default
810 adding remote bookmark foo
811 adding remote bookmark four
812 adding remote bookmark should-end-on-two
813 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
814 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
815 3:125c9a1d6df6
816 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
817 * Y 3:125c9a1d6df6
818
819 (pulling revision on current named/topological branch with --update
820 updates the working directory and current active bookmark)
821
822 $ hg update -C -q 125c9a1d6df6
823 $ echo xx >> x
824 $ hg commit -m xx
825
826 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
827 * Y 3:125c9a1d6df6
828 $ hg -R ../cloned-bookmarks-update pull . --update
829 pulling from .
830 searching for changes
831 adding changesets
832 adding manifests
833 adding file changes
834 added 1 changesets with 1 changes to 1 files
835 divergent bookmark Z stored as Z@default
836 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 updating bookmark Y
838 $ hg -R ../cloned-bookmarks-update parents -T "{rev}:{node|short}\n"
839 6:81dcce76aa0b
840 $ hg -R ../cloned-bookmarks-update bookmarks | grep ' Y '
841 * Y 6:81dcce76aa0b