changeset 30902:e6932e9a262a

merge: remove unused handling of default destination in merge.update() As far as I can tell, all the callers of merge.update() have been migrated over to use destutil to find the default destination when the revision was not specified. So it's time to delete the code for handling a node value of None. Let's add an assertion that node is not None, so any extensions relying on it will not silently misbehave.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 08 Feb 2017 23:03:33 -0800
parents 47278970fc8c
children dd995a5db8fd
files mercurial/merge.py
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Feb 08 14:49:37 2017 -0800
+++ b/mercurial/merge.py	Wed Feb 08 23:03:33 2017 -0800
@@ -1448,7 +1448,7 @@
     """
     Perform a merge between the working directory and the given node
 
-    node = the node to update to, or None if unspecified
+    node = the node to update to
     branchmerge = whether to merge between branches
     force = whether to force branch merging or file overwriting
     matcher = a matcher to filter file lists (dirstate not updated)
@@ -1491,7 +1491,9 @@
     Return the same tuple as applyupdates().
     """
 
-    onode = node
+    # This functon used to find the default destination if node was None, but
+    # that's now in destutil.py.
+    assert node is not None
     # If we're doing a partial update, we need to skip updating
     # the dirstate, so make a note of any partial-ness to the
     # update here.
@@ -1550,25 +1552,16 @@
 
             if pas not in ([p1], [p2]):  # nonlinear
                 dirty = wc.dirty(missing=True)
-                if dirty or onode is None:
+                if dirty:
                     # Branching is a bit strange to ensure we do the minimal
                     # amount of call to obsolete.background.
                     foreground = obsolete.foreground(repo, [p1.node()])
                     # note: the <node> variable contains a random identifier
                     if repo[node].node() in foreground:
                         pass # allow updating to successors
-                    elif dirty:
+                    else:
                         msg = _("uncommitted changes")
-                        if onode is None:
-                            hint = _("commit and merge, or update --clean to"
-                                     " discard changes")
-                        else:
-                            hint = _("commit or update --clean to discard"
-                                     " changes")
-                        raise error.Abort(msg, hint=hint)
-                    else:  # node is none
-                        msg = _("not a linear update")
-                        hint = _("merge or update --check to force update")
+                        hint = _("commit or update --clean to discard changes")
                         raise error.Abort(msg, hint=hint)
                 else:
                     # Allow jumping branches if clean and specific rev given