##// END OF EJS Templates
merge: consider successor changesets for a bare update...
Sean Farley -
r20280:95b9c614 default
parent child Browse files
Show More
@@ -696,6 +696,34 b' def update(repo, node, branchmerge, forc'
696 node = repo.lookup("tip") # update to tip
696 node = repo.lookup("tip") # update to tip
697 else:
697 else:
698 raise util.Abort(_("branch %s not found") % wc.branch())
698 raise util.Abort(_("branch %s not found") % wc.branch())
699
700 if p1.obsolete() and not p1.children():
701 # allow updating to successors
702 successors = obsolete.successorssets(repo, p1.node())
703
704 # behavior of certain cases is as follows,
705 #
706 # divergent changesets: update to highest rev, similar to what
707 # is currently done when there are more than one head
708 # (i.e. 'tip')
709 #
710 # replaced changesets: same as divergent except we know there
711 # is no conflict
712 #
713 # pruned changeset: no update is done; though, we could
714 # consider updating to the first non-obsolete parent,
715 # similar to what is current done for 'hg prune'
716
717 if successors:
718 # flatten the list here handles both divergent (len > 1)
719 # and the usual case (len = 1)
720 successors = [n for sub in successors for n in sub]
721
722 # get the max revision for the given successors set,
723 # i.e. the 'tip' of a set
724 node = repo.revs("max(%ln)", successors)[0]
725 pa = p1
726
699 overwrite = force and not branchmerge
727 overwrite = force and not branchmerge
700
728
701 p2 = repo[node]
729 p2 = repo[node]
@@ -229,6 +229,14 b' the bookmark (issue4015)'
229 $ hg bookmarks
229 $ hg bookmarks
230 * bm 5:ff252e8273df
230 * bm 5:ff252e8273df
231
231
232 Test that 4 is detected as the no-argument destination from 3
233 $ hg up --quiet 0 # we should be able to update to 3 directly
234 $ hg up --quiet --hidden 3 # but not implemented yet.
235 $ hg up
236 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 $ hg id
238 d047485b3896+ (b1)
239
232 Test that 5 is detected as a valid destination from 1
240 Test that 5 is detected as a valid destination from 1
233 $ hg up --quiet 0 # we should be able to update to 3 directly
241 $ hg up --quiet 0 # we should be able to update to 3 directly
234 $ hg up --quiet --hidden 3 # but not implemented yet.
242 $ hg up --quiet --hidden 3 # but not implemented yet.
@@ -242,3 +250,14 b' Test that 5 is not detected as a valid d'
242 abort: uncommitted changes
250 abort: uncommitted changes
243 (commit or update --clean to discard changes)
251 (commit or update --clean to discard changes)
244 [255]
252 [255]
253
254 Test that we don't crash when updating from a pruned changeset (i.e. has no
255 successors). Behavior should probably be that we update to the first
256 non-obsolete parent but that will be decided later.
257 $ hg id --debug -r 2
258 bd10386d478cd5a9faf2e604114c8e6da62d3889
259 $ hg up --quiet 0
260 $ hg up --quiet 2
261 $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
262 $ hg up
263 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now