Quantcast

[PATCH 1 of 4 V4] update: accept --merge to allow merging across topo branches (issue5125)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 1 of 4 V4] update: accept --merge to allow merging across topo branches (issue5125)

Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk <[hidden email]>
# Date 1487019517 28800
#      Mon Feb 13 12:58:37 2017 -0800
# Node ID 19f471c814809099b5452b1174a2ecb0699cb76a
# Parent  1ee685defe80117cf6aafea1ede6c33c478abceb
update: accept --merge to allow merging across topo branches (issue5125)

diff -r 1ee685defe80 -r 19f471c81480 mercurial/commands.py
--- a/mercurial/commands.py Wed Feb 15 16:29:58 2017 -0800
+++ b/mercurial/commands.py Mon Feb 13 12:58:37 2017 -0800
@@ -5286,12 +5286,13 @@
 @command('^update|up|checkout|co',
     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
     ('c', 'check', None, _('require clean working directory')),
+    ('m', 'merge', None, _('merge local changes')),
     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
     ('r', 'rev', '', _('revision'), _('REV'))
      ] + mergetoolopts,
-    _('[-C|-c] [-d DATE] [[-r] REV]'))
+    _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
-           tool=None):
+           merge=None, tool=None):
     """update working directory (or switch revisions)
 
     Update the repository's working directory to the specified
@@ -5310,8 +5311,8 @@
 
     .. container:: verbose
 
-      The -C/--clean and -c/--check options control what happens if the
-      working directory contains uncommitted changes.
+      The -C/--clean, -c/--check, and -m/--merge options control what
+      happens if the working directory contains uncommitted changes.
       At most of one of them can be specified.
 
       1. If no option is specified, and if
@@ -5323,10 +5324,14 @@
          branch), the update is aborted and the uncommitted changes
          are preserved.
 
-      2. With the -c/--check option, the update is aborted and the
+      2. With the -m/--merge option, the update is allowed even if the
+         requested changeset is not an ancestor or descendant of
+         the working directory's parent.
+
+      3. With the -c/--check option, the update is aborted and the
          uncommitted changes are preserved.
 
-      3. With the -C/--clean option, uncommitted changes are discarded and
+      4. With the -C/--clean option, uncommitted changes are discarded and
          the working directory is updated to the requested changeset.
 
     To cancel an uncommitted merge (and lose your changes), use
@@ -5351,8 +5356,15 @@
     if date and rev is not None:
         raise error.Abort(_("you can't specify a revision and a date"))
 
-    if check and clean:
-        raise error.Abort(_("cannot specify both -c/--check and -C/--clean"))
+    if len([x for x in (clean, check, merge) if x]) > 1:
+        raise error.Abort(_("can only specify one of -C/--clean, -c/--check, "
+                            "or -m/merge"))
+
+    updatecheck = None
+    if check:
+        updatecheck = 'abort'
+    elif merge:
+        updatecheck = 'none'
 
     with repo.wlock():
         cmdutil.clearunfinished(repo)
@@ -5366,7 +5378,8 @@
 
         repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
 
-        return hg.updatetotally(ui, repo, rev, brev, clean=clean, check=check)
+        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
+                                updatecheck=updatecheck)
 
 @command('verify', [])
 def verify(ui, repo):
diff -r 1ee685defe80 -r 19f471c81480 mercurial/hg.py
--- a/mercurial/hg.py Wed Feb 15 16:29:58 2017 -0800
+++ b/mercurial/hg.py Mon Feb 13 12:58:37 2017 -0800
@@ -681,18 +681,19 @@
     repo.ui.status(_("%d files updated, %d files merged, "
                      "%d files removed, %d files unresolved\n") % stats)
 
-def updaterepo(repo, node, overwrite):
+def updaterepo(repo, node, overwrite, updatecheck=None):
     """Update the working directory to node.
 
     When overwrite is set, changes are clobbered, merged else
 
     returns stats (see pydoc mercurial.merge.applyupdates)"""
     return mergemod.update(repo, node, False, overwrite,
-                           labels=['working copy', 'destination'])
+                           labels=['working copy', 'destination'],
+                           updatecheck=updatecheck)
 
-def update(repo, node, quietempty=False):
-    """update the working directory to node, merging linear changes"""
-    stats = updaterepo(repo, node, False)
+def update(repo, node, quietempty=False, updatecheck=None):
+    """update the working directory to node"""
+    stats = updaterepo(repo, node, False, updatecheck=updatecheck)
     _showstats(repo, stats, quietempty)
     if stats[3]:
         repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
@@ -712,7 +713,7 @@
 # naming conflict in updatetotally()
 _clean = clean
 
-def updatetotally(ui, repo, checkout, brev, clean=False, check=False):
+def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None):
     """Update the working directory with extra care for non-file components
 
     This takes care of non-file components below:
@@ -724,10 +725,19 @@
     :checkout: to which revision the working directory is updated
     :brev: a name, which might be a bookmark to be activated after updating
     :clean: whether changes in the working directory can be discarded
-    :check: whether changes in the working directory should be checked
+    :updatecheck: how to deal with a dirty working directory
+
+    Valid values for updatecheck are (None => linear):
+
+     * abort: abort if the working directory is dirty
+     * none: don't check (merge working directory changes into destination)
+     * linear: check that update is linear before merging working directory
+               changes into destination
 
     This returns whether conflict is detected at updating or not.
     """
+    if updatecheck is None:
+        updatecheck = 'linear'
     with repo.wlock():
         movemarkfrom = None
         warndest = False
@@ -739,9 +749,10 @@
         if clean:
             ret = _clean(repo, checkout)
         else:
-            if check:
+            if updatecheck == 'abort':
                 cmdutil.bailifchanged(repo, merge=False)
-            ret = _update(repo, checkout)
+                updatecheck = 'none'
+            ret = _update(repo, checkout, updatecheck=updatecheck)
 
         if not ret and movemarkfrom:
             if movemarkfrom == repo['.'].node():
diff -r 1ee685defe80 -r 19f471c81480 mercurial/merge.py
--- a/mercurial/merge.py Wed Feb 15 16:29:58 2017 -0800
+++ b/mercurial/merge.py Mon Feb 13 12:58:37 2017 -0800
@@ -1444,7 +1444,8 @@
             repo.dirstate.normal(f)
 
 def update(repo, node, branchmerge, force, ancestor=None,
-           mergeancestor=False, labels=None, matcher=None, mergeforce=False):
+           mergeancestor=False, labels=None, matcher=None, mergeforce=False,
+           updatecheck=None):
     """
     Perform a merge between the working directory and the given node
 
@@ -1491,9 +1492,16 @@
     Return the same tuple as applyupdates().
     """
 
-    # This functon used to find the default destination if node was None, but
+    # This function used to find the default destination if node was None, but
     # that's now in destutil.py.
     assert node is not None
+    if not branchmerge and not force:
+        # TODO: remove the default once all callers that pass branchmerge=False
+        # and force=False pass a value for updatecheck. We may want to allow
+        # updatecheck='abort' to better suppport some of these callers.
+        if updatecheck is None:
+            updatecheck = 'linear'
+        assert updatecheck in ('none', 'linear')
     # 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,7 +1558,8 @@
                 repo.hook('update', parent1=xp2, parent2='', error=0)
                 return 0, 0, 0, 0
 
-            if pas not in ([p1], [p2]):  # nonlinear
+            if (updatecheck == 'linear' and
+                    pas not in ([p1], [p2])):  # nonlinear
                 dirty = wc.dirty(missing=True)
                 if dirty:
                     # Branching is a bit strange to ensure we do the minimal
diff -r 1ee685defe80 -r 19f471c81480 tests/test-completion.t
--- a/tests/test-completion.t Wed Feb 15 16:29:58 2017 -0800
+++ b/tests/test-completion.t Mon Feb 13 12:58:37 2017 -0800
@@ -223,7 +223,7 @@
   serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate
   status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
   summary: remote
-  update: clean, check, date, rev, tool
+  update: clean, check, merge, date, rev, tool
   addremove: similarity, subrepos, include, exclude, dry-run
   archive: no-decode, prefix, rev, type, subrepos, include, exclude
   backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
diff -r 1ee685defe80 -r 19f471c81480 tests/test-update-branches.t
--- a/tests/test-update-branches.t Wed Feb 15 16:29:58 2017 -0800
+++ b/tests/test-update-branches.t Mon Feb 13 12:58:37 2017 -0800
@@ -160,6 +160,16 @@
   parent=1
   M foo
 
+  $ revtest '-m dirty linear'   dirty 1 2 -m
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+  M foo
+
+  $ revtest '-m dirty cross'  dirty 3 4 -m
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=4
+  M foo
+
   $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
   abort: uncommitted changes in subrepository 'sub'
   parent=1
@@ -171,7 +181,17 @@
   parent=2
 
   $ revtest '-cC dirty linear'  dirty 1 2 -cC
-  abort: cannot specify both -c/--check and -C/--clean
+  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
+  parent=1
+  M foo
+
+  $ revtest '-mc dirty linear'  dirty 1 2 -mc
+  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
+  parent=1
+  M foo
+
+  $ revtest '-mC dirty linear'  dirty 1 2 -mC
+  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
   parent=1
   M foo
 
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 2 of 4 V4] update: add experimental config for default way of handling dirty wdir

Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk <[hidden email]>
# Date 1487030585 28800
#      Mon Feb 13 16:03:05 2017 -0800
# Node ID ce8d9fd4b41df0744a456de37ad5e93c8ca1d1db
# Parent  19f471c814809099b5452b1174a2ecb0699cb76a
update: add experimental config for default way of handling dirty wdir

This allows the user to set e.g. experimental.updatecheck=abort to
abort update if the working directory is dirty, but still be able to
override the behavior with e.g. --merge when needed.

I considered adding a --mergelinear option to get back the old
behavior even when experimental.updatecheck=abort is set, but I
couldn't see why anyone would prefer that over --merge.

The default is read in hg.updatetotally(), which means it also applies
to "hg pull -u" and "hg unbundle -u".

diff -r 19f471c81480 -r ce8d9fd4b41d mercurial/hg.py
--- a/mercurial/hg.py Mon Feb 13 12:58:37 2017 -0800
+++ b/mercurial/hg.py Mon Feb 13 16:03:05 2017 -0800
@@ -737,7 +737,10 @@
     This returns whether conflict is detected at updating or not.
     """
     if updatecheck is None:
-        updatecheck = 'linear'
+        updatecheck = ui.config('experimental', 'updatecheck')
+        if updatecheck not in ('abort', 'none', 'linear'):
+            # If not configured, or invalid value configured
+            updatecheck = 'linear'
     with repo.wlock():
         movemarkfrom = None
         warndest = False
diff -r 19f471c81480 -r ce8d9fd4b41d tests/test-pull-update.t
--- a/tests/test-pull-update.t Mon Feb 13 12:58:37 2017 -0800
+++ b/tests/test-pull-update.t Mon Feb 13 16:03:05 2017 -0800
@@ -16,6 +16,21 @@
   $ echo 1.2 > foo
   $ hg ci -Am m
 
+Should respect config to disable dirty update
+  $ hg co -qC 0
+  $ echo 2 > foo
+  $ hg --config experimental.updatecheck=abort pull -u ../tt
+  pulling from ../tt
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  abort: uncommitted changes
+  [255]
+  $ hg --config extensions.strip= strip --no-backup tip
+  $ hg co -qC tip
+
 Should not update to the other topological branch:
 
   $ hg pull -u ../tt
diff -r 19f471c81480 -r ce8d9fd4b41d tests/test-update-branches.t
--- a/tests/test-update-branches.t Mon Feb 13 12:58:37 2017 -0800
+++ b/tests/test-update-branches.t Mon Feb 13 16:03:05 2017 -0800
@@ -195,6 +195,81 @@
   parent=1
   M foo
 
+  $ echo '[experimental]' >> .hg/hgrc
+  $ echo 'updatecheck = abort' >> .hg/hgrc
+
+  $ revtest 'none dirty linear' dirty 1 2
+  abort: uncommitted changes
+  parent=1
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2 -c
+  abort: uncommitted changes
+  parent=1
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2 -C
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+
+  $ echo 'updatecheck = none' >> .hg/hgrc
+
+  $ revtest 'none dirty cross'  dirty 3 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=4
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2 -c
+  abort: uncommitted changes
+  parent=1
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2 -C
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+
+  $ hg co -qC 3
+  $ echo dirty >> a
+  $ hg co --tool :merge3 4
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+  $ hg st
+  M a
+  ? a.orig
+  $ cat a
+  <<<<<<< working copy: 6efa171f091b - test: 3
+  three
+  dirty
+  ||||||| base
+  three
+  =======
+  four
+  >>>>>>> destination:  d047485b3896 b1 - test: 4
+  $ rm a.orig
+
+Uses default value of "linear" when value is misspelled
+  $ echo 'updatecheck = linyar' >> .hg/hgrc
+
+  $ revtest 'dirty cross'  dirty 3 4
+  abort: uncommitted changes
+  (commit or update --clean to discard changes)
+  parent=3
+  M foo
+
+Setup for later tests
+  $ revtest 'none dirty linear' dirty 1 2 -c
+  abort: uncommitted changes
+  parent=1
+  M foo
+
   $ cd ..
 
 Test updating to null revision
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 3 of 4 V4] update: allow setting default update check to "noconflict"

Martin von Zweigbergk via Mercurial-devel
In reply to this post by Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk <[hidden email]>
# Date 1486973155 28800
#      Mon Feb 13 00:05:55 2017 -0800
# Node ID 572ffc6ab9724bb7b1d4d3315fd8deaf9d52461a
# Parent  ce8d9fd4b41df0744a456de37ad5e93c8ca1d1db
update: allow setting default update check to "noconflict"

The new value allows update (linear or not) as long as they don't
result in file merges.

I'm hoping that this value can some day become the default.

diff -r ce8d9fd4b41d -r 572ffc6ab972 mercurial/hg.py
--- a/mercurial/hg.py Mon Feb 13 16:03:05 2017 -0800
+++ b/mercurial/hg.py Mon Feb 13 00:05:55 2017 -0800
@@ -733,12 +733,13 @@
      * none: don't check (merge working directory changes into destination)
      * linear: check that update is linear before merging working directory
                changes into destination
+     * noconflict: check that the update does not result in file merges
 
     This returns whether conflict is detected at updating or not.
     """
     if updatecheck is None:
         updatecheck = ui.config('experimental', 'updatecheck')
-        if updatecheck not in ('abort', 'none', 'linear'):
+        if updatecheck not in ('abort', 'none', 'linear', 'noconflict'):
             # If not configured, or invalid value configured
             updatecheck = 'linear'
     with repo.wlock():
diff -r ce8d9fd4b41d -r 572ffc6ab972 mercurial/merge.py
--- a/mercurial/merge.py Mon Feb 13 16:03:05 2017 -0800
+++ b/mercurial/merge.py Mon Feb 13 00:05:55 2017 -0800
@@ -1501,7 +1501,7 @@
         # updatecheck='abort' to better suppport some of these callers.
         if updatecheck is None:
             updatecheck = 'linear'
-        assert updatecheck in ('none', 'linear')
+        assert updatecheck in ('none', 'linear', 'noconflict')
     # 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.
@@ -1595,6 +1595,13 @@
             repo, wc, p2, pas, branchmerge, force, mergeancestor,
             followcopies, matcher=matcher, mergeforce=mergeforce)
 
+        if updatecheck == 'noconflict':
+            for f, (m, args, msg) in actionbyfile.iteritems():
+                if m not in ('g', 'k', 'r'):
+                    msg = _("uncommitted changes")
+                    hint = _("commit or update --merge to allow merge")
+                    raise error.Abort(msg, hint=hint)
+
         # Prompt and create actions. Most of this is in the resolve phase
         # already, but we can't handle .hgsubstate in filemerge or
         # subrepo.submerge yet so we have to keep prompting for it.
diff -r ce8d9fd4b41d -r 572ffc6ab972 tests/test-update-branches.t
--- a/tests/test-update-branches.t Mon Feb 13 16:03:05 2017 -0800
+++ b/tests/test-update-branches.t Mon Feb 13 00:05:55 2017 -0800
@@ -255,6 +255,65 @@
   >>>>>>> destination:  d047485b3896 b1 - test: 4
   $ rm a.orig
 
+  $ echo 'updatecheck = noconflict' >> .hg/hgrc
+
+  $ revtest 'none dirty cross'  dirty 3 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=4
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2 -c
+  abort: uncommitted changes
+  parent=1
+  M foo
+
+  $ revtest 'none dirty linear' dirty 1 2 -C
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+
+Locally added file is allowed
+  $ hg up -qC 3
+  $ echo a > bar
+  $ hg add bar
+  $ hg up -q 4
+  $ hg st
+  A bar
+  $ hg forget bar
+  $ rm bar
+
+Locally removed file is allowed
+  $ hg up -qC 3
+  $ hg rm a
+  $ hg up -q 4
+  abort: uncommitted changes
+  (commit or update --merge to allow merge)
+  [255]
+
+File conflict is not allowed
+  $ hg up -qC 3
+  $ echo dirty >> a
+  $ hg up -q 4
+  abort: uncommitted changes
+  (commit or update --merge to allow merge)
+  [255]
+  $ hg up -m 4
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+  $ rm a.orig
+
+Change/delete conflict is not allowed
+  $ hg up -qC 3
+  $ hg rm foo
+  $ hg up -q 4
+
 Uses default value of "linear" when value is misspelled
   $ echo 'updatecheck = linyar' >> .hg/hgrc
 
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 4 of 4 V4] update: also suggest --merge when non-linear update is aborted

Martin von Zweigbergk via Mercurial-devel
In reply to this post by Martin von Zweigbergk via Mercurial-devel
# HG changeset patch
# User Martin von Zweigbergk <[hidden email]>
# Date 1487140898 28800
#      Tue Feb 14 22:41:38 2017 -0800
# Node ID 23ce2ec6c9b701f0eacac61df7048cfd36fa47fc
# Parent  572ffc6ab9724bb7b1d4d3315fd8deaf9d52461a
update: also suggest --merge when non-linear update is aborted

diff -r 572ffc6ab972 -r 23ce2ec6c9b7 mercurial/merge.py
--- a/mercurial/merge.py Mon Feb 13 00:05:55 2017 -0800
+++ b/mercurial/merge.py Tue Feb 14 22:41:38 2017 -0800
@@ -1570,7 +1570,8 @@
                         pass # allow updating to successors
                     else:
                         msg = _("uncommitted changes")
-                        hint = _("commit or update --clean to discard changes")
+                        hint = _("commit, or use --clean to discard changes, "
+                                 "or use --merge to allow update")
                         raise error.UpdateAbort(msg, hint=hint)
                 else:
                     # Allow jumping branches if clean and specific rev given
diff -r 572ffc6ab972 -r 23ce2ec6c9b7 tests/test-merge5.t
--- a/tests/test-merge5.t Mon Feb 13 00:05:55 2017 -0800
+++ b/tests/test-merge5.t Tue Feb 14 22:41:38 2017 -0800
@@ -26,7 +26,7 @@
 
   $ hg update 1
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   [255]
   $ mv c a
 
diff -r 572ffc6ab972 -r 23ce2ec6c9b7 tests/test-subrepo-svn.t
--- a/tests/test-subrepo-svn.t Mon Feb 13 00:05:55 2017 -0800
+++ b/tests/test-subrepo-svn.t Tue Feb 14 22:41:38 2017 -0800
@@ -472,7 +472,7 @@
   $ echo "updating should (maybe) fail" > obstruct/other
   $ hg co tip
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   [255]
 
 Point to a Subversion branch which has since been deleted and recreated
diff -r 572ffc6ab972 -r 23ce2ec6c9b7 tests/test-update-branches.t
--- a/tests/test-update-branches.t Mon Feb 13 00:05:55 2017 -0800
+++ b/tests/test-update-branches.t Tue Feb 14 22:41:38 2017 -0800
@@ -123,19 +123,19 @@
 
   $ revtest 'none dirty same'   dirty 2 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   parent=2
   M foo
 
   $ revtest 'none dirtysub same'   dirtysub 2 3
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   parent=2
   M sub/suba
 
   $ revtest 'none dirty cross'  dirty 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   parent=3
   M foo
 
@@ -147,7 +147,7 @@
 
   $ revtest 'none dirtysub cross'  dirtysub 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   parent=3
   M sub/suba
 
@@ -319,7 +319,7 @@
 
   $ revtest 'dirty cross'  dirty 3 4
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   parent=3
   M foo
 
@@ -537,7 +537,7 @@
   $ hg up --quiet 2
   $ hg up 5
   abort: uncommitted changes
-  (commit or update --clean to discard changes)
+  (commit, or use --clean to discard changes, or use --merge to allow update)
   [255]
 
 Test that we don't crash when updating from a pruned changeset (i.e. has no
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1 of 4 V4] update: accept --merge to allow merging across topo branches (issue5125)

Jun Wu
In reply to this post by Martin von Zweigbergk via Mercurial-devel
I like the behavior change (didn't check the implementation details
carefully).

Could you also update the table in the docstring of merge.update? I think
that's very helpful to explain the behavior cleanly. Thanks!

Excerpts from Martin von Zweigbergk's message of 2017-02-16 08:59:12 -0800:

> # HG changeset patch
> # User Martin von Zweigbergk <[hidden email]>
> # Date 1487019517 28800
> #      Mon Feb 13 12:58:37 2017 -0800
> # Node ID 19f471c814809099b5452b1174a2ecb0699cb76a
> # Parent  1ee685defe80117cf6aafea1ede6c33c478abceb
> update: accept --merge to allow merging across topo branches (issue5125)
>
> diff -r 1ee685defe80 -r 19f471c81480 mercurial/commands.py
> --- a/mercurial/commands.py    Wed Feb 15 16:29:58 2017 -0800
> +++ b/mercurial/commands.py    Mon Feb 13 12:58:37 2017 -0800
> @@ -5286,12 +5286,13 @@
>  @command('^update|up|checkout|co',
>      [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
>      ('c', 'check', None, _('require clean working directory')),
> +    ('m', 'merge', None, _('merge local changes')),
>      ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
>      ('r', 'rev', '', _('revision'), _('REV'))
>       ] + mergetoolopts,
> -    _('[-C|-c] [-d DATE] [[-r] REV]'))
> +    _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
>  def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
> -           tool=None):
> +           merge=None, tool=None):
>      """update working directory (or switch revisions)
>  
>      Update the repository's working directory to the specified
> @@ -5310,8 +5311,8 @@
>  
>      .. container:: verbose
>  
> -      The -C/--clean and -c/--check options control what happens if the
> -      working directory contains uncommitted changes.
> +      The -C/--clean, -c/--check, and -m/--merge options control what
> +      happens if the working directory contains uncommitted changes.
>        At most of one of them can be specified.
>  
>        1. If no option is specified, and if
> @@ -5323,10 +5324,14 @@
>           branch), the update is aborted and the uncommitted changes
>           are preserved.
>  
> -      2. With the -c/--check option, the update is aborted and the
> +      2. With the -m/--merge option, the update is allowed even if the
> +         requested changeset is not an ancestor or descendant of
> +         the working directory's parent.
> +
> +      3. With the -c/--check option, the update is aborted and the
>           uncommitted changes are preserved.
>  
> -      3. With the -C/--clean option, uncommitted changes are discarded and
> +      4. With the -C/--clean option, uncommitted changes are discarded and
>           the working directory is updated to the requested changeset.
>  
>      To cancel an uncommitted merge (and lose your changes), use
> @@ -5351,8 +5356,15 @@
>      if date and rev is not None:
>          raise error.Abort(_("you can't specify a revision and a date"))
>  
> -    if check and clean:
> -        raise error.Abort(_("cannot specify both -c/--check and -C/--clean"))
> +    if len([x for x in (clean, check, merge) if x]) > 1:
> +        raise error.Abort(_("can only specify one of -C/--clean, -c/--check, "
> +                            "or -m/merge"))
> +
> +    updatecheck = None
> +    if check:
> +        updatecheck = 'abort'
> +    elif merge:
> +        updatecheck = 'none'
>  
>      with repo.wlock():
>          cmdutil.clearunfinished(repo)
> @@ -5366,7 +5378,8 @@
>  
>          repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
>  
> -        return hg.updatetotally(ui, repo, rev, brev, clean=clean, check=check)
> +        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
> +                                updatecheck=updatecheck)
>  
>  @command('verify', [])
>  def verify(ui, repo):
> diff -r 1ee685defe80 -r 19f471c81480 mercurial/hg.py
> --- a/mercurial/hg.py    Wed Feb 15 16:29:58 2017 -0800
> +++ b/mercurial/hg.py    Mon Feb 13 12:58:37 2017 -0800
> @@ -681,18 +681,19 @@
>      repo.ui.status(_("%d files updated, %d files merged, "
>                       "%d files removed, %d files unresolved\n") % stats)
>  
> -def updaterepo(repo, node, overwrite):
> +def updaterepo(repo, node, overwrite, updatecheck=None):
>      """Update the working directory to node.
>  
>      When overwrite is set, changes are clobbered, merged else
>  
>      returns stats (see pydoc mercurial.merge.applyupdates)"""
>      return mergemod.update(repo, node, False, overwrite,
> -                           labels=['working copy', 'destination'])
> +                           labels=['working copy', 'destination'],
> +                           updatecheck=updatecheck)
>  
> -def update(repo, node, quietempty=False):
> -    """update the working directory to node, merging linear changes"""
> -    stats = updaterepo(repo, node, False)
> +def update(repo, node, quietempty=False, updatecheck=None):
> +    """update the working directory to node"""
> +    stats = updaterepo(repo, node, False, updatecheck=updatecheck)
>      _showstats(repo, stats, quietempty)
>      if stats[3]:
>          repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
> @@ -712,7 +713,7 @@
>  # naming conflict in updatetotally()
>  _clean = clean
>  
> -def updatetotally(ui, repo, checkout, brev, clean=False, check=False):
> +def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None):
>      """Update the working directory with extra care for non-file components
>  
>      This takes care of non-file components below:
> @@ -724,10 +725,19 @@
>      :checkout: to which revision the working directory is updated
>      :brev: a name, which might be a bookmark to be activated after updating
>      :clean: whether changes in the working directory can be discarded
> -    :check: whether changes in the working directory should be checked
> +    :updatecheck: how to deal with a dirty working directory
> +
> +    Valid values for updatecheck are (None => linear):
> +
> +     * abort: abort if the working directory is dirty
> +     * none: don't check (merge working directory changes into destination)
> +     * linear: check that update is linear before merging working directory
> +               changes into destination
>  
>      This returns whether conflict is detected at updating or not.
>      """
> +    if updatecheck is None:
> +        updatecheck = 'linear'
>      with repo.wlock():
>          movemarkfrom = None
>          warndest = False
> @@ -739,9 +749,10 @@
>          if clean:
>              ret = _clean(repo, checkout)
>          else:
> -            if check:
> +            if updatecheck == 'abort':
>                  cmdutil.bailifchanged(repo, merge=False)
> -            ret = _update(repo, checkout)
> +                updatecheck = 'none'
> +            ret = _update(repo, checkout, updatecheck=updatecheck)
>  
>          if not ret and movemarkfrom:
>              if movemarkfrom == repo['.'].node():
> diff -r 1ee685defe80 -r 19f471c81480 mercurial/merge.py
> --- a/mercurial/merge.py    Wed Feb 15 16:29:58 2017 -0800
> +++ b/mercurial/merge.py    Mon Feb 13 12:58:37 2017 -0800
> @@ -1444,7 +1444,8 @@
>              repo.dirstate.normal(f)
>  
>  def update(repo, node, branchmerge, force, ancestor=None,
> -           mergeancestor=False, labels=None, matcher=None, mergeforce=False):
> +           mergeancestor=False, labels=None, matcher=None, mergeforce=False,
> +           updatecheck=None):
>      """
>      Perform a merge between the working directory and the given node
>  
> @@ -1491,9 +1492,16 @@
>      Return the same tuple as applyupdates().
>      """
>  
> -    # This functon used to find the default destination if node was None, but
> +    # This function used to find the default destination if node was None, but
>      # that's now in destutil.py.
>      assert node is not None
> +    if not branchmerge and not force:
> +        # TODO: remove the default once all callers that pass branchmerge=False
> +        # and force=False pass a value for updatecheck. We may want to allow
> +        # updatecheck='abort' to better suppport some of these callers.
> +        if updatecheck is None:
> +            updatecheck = 'linear'
> +        assert updatecheck in ('none', 'linear')
>      # 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,7 +1558,8 @@
>                  repo.hook('update', parent1=xp2, parent2='', error=0)
>                  return 0, 0, 0, 0
>  
> -            if pas not in ([p1], [p2]):  # nonlinear
> +            if (updatecheck == 'linear' and
> +                    pas not in ([p1], [p2])):  # nonlinear
>                  dirty = wc.dirty(missing=True)
>                  if dirty:
>                      # Branching is a bit strange to ensure we do the minimal
> diff -r 1ee685defe80 -r 19f471c81480 tests/test-completion.t
> --- a/tests/test-completion.t    Wed Feb 15 16:29:58 2017 -0800
> +++ b/tests/test-completion.t    Mon Feb 13 12:58:37 2017 -0800
> @@ -223,7 +223,7 @@
>    serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate
>    status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
>    summary: remote
> -  update: clean, check, date, rev, tool
> +  update: clean, check, merge, date, rev, tool
>    addremove: similarity, subrepos, include, exclude, dry-run
>    archive: no-decode, prefix, rev, type, subrepos, include, exclude
>    backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
> diff -r 1ee685defe80 -r 19f471c81480 tests/test-update-branches.t
> --- a/tests/test-update-branches.t    Wed Feb 15 16:29:58 2017 -0800
> +++ b/tests/test-update-branches.t    Mon Feb 13 12:58:37 2017 -0800
> @@ -160,6 +160,16 @@
>    parent=1
>    M foo
>  
> +  $ revtest '-m dirty linear'   dirty 1 2 -m
> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  parent=2
> +  M foo
> +
> +  $ revtest '-m dirty cross'  dirty 3 4 -m
> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  parent=4
> +  M foo
> +
>    $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
>    abort: uncommitted changes in subrepository 'sub'
>    parent=1
> @@ -171,7 +181,17 @@
>    parent=2
>  
>    $ revtest '-cC dirty linear'  dirty 1 2 -cC
> -  abort: cannot specify both -c/--check and -C/--clean
> +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> +  parent=1
> +  M foo
> +
> +  $ revtest '-mc dirty linear'  dirty 1 2 -mc
> +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> +  parent=1
> +  M foo
> +
> +  $ revtest '-mC dirty linear'  dirty 1 2 -mC
> +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
>    parent=1
>    M foo
>  
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1 of 4 V4] update: accept --merge to allow merging across topo branches (issue5125)

Martin von Zweigbergk via Mercurial-devel

Sure. I'm on vacation, so I can do that next week, or in a follow-up. Whichever the person considering queuing prefers.


On Tue, Feb 21, 2017, 14:18 Jun Wu <[hidden email]> wrote:
I like the behavior change (didn't check the implementation details
carefully).

Could you also update the table in the docstring of merge.update? I think
that's very helpful to explain the behavior cleanly. Thanks!

Excerpts from Martin von Zweigbergk's message of 2017-02-16 08:59:12 -0800:
> # HG changeset patch
> # User Martin von Zweigbergk <[hidden email]>
> # Date 1487019517 28800
> #      Mon Feb 13 12:58:37 2017 -0800
> # Node ID 19f471c814809099b5452b1174a2ecb0699cb76a
> # Parent  1ee685defe80117cf6aafea1ede6c33c478abceb
> update: accept --merge to allow merging across topo branches (issue5125)
>
> diff -r 1ee685defe80 -r 19f471c81480 mercurial/commands.py
> --- a/mercurial/commands.py    Wed Feb 15 16:29:58 2017 -0800
> +++ b/mercurial/commands.py    Mon Feb 13 12:58:37 2017 -0800
> @@ -5286,12 +5286,13 @@
>  @command('^update|up|checkout|co',
>      [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
>      ('c', 'check', None, _('require clean working directory')),
> +    ('m', 'merge', None, _('merge local changes')),
>      ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
>      ('r', 'rev', '', _('revision'), _('REV'))
>       ] + mergetoolopts,
> -    _('[-C|-c] [-d DATE] [[-r] REV]'))
> +    _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
>  def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
> -           tool=None):
> +           merge=None, tool=None):
>      """update working directory (or switch revisions)
>
>      Update the repository's working directory to the specified
> @@ -5310,8 +5311,8 @@
>
>      .. container:: verbose
>
> -      The -C/--clean and -c/--check options control what happens if the
> -      working directory contains uncommitted changes.
> +      The -C/--clean, -c/--check, and -m/--merge options control what
> +      happens if the working directory contains uncommitted changes.
>        At most of one of them can be specified.
>
>        1. If no option is specified, and if
> @@ -5323,10 +5324,14 @@
>           branch), the update is aborted and the uncommitted changes
>           are preserved.
>
> -      2. With the -c/--check option, the update is aborted and the
> +      2. With the -m/--merge option, the update is allowed even if the
> +         requested changeset is not an ancestor or descendant of
> +         the working directory's parent.
> +
> +      3. With the -c/--check option, the update is aborted and the
>           uncommitted changes are preserved.
>
> -      3. With the -C/--clean option, uncommitted changes are discarded and
> +      4. With the -C/--clean option, uncommitted changes are discarded and
>           the working directory is updated to the requested changeset.
>
>      To cancel an uncommitted merge (and lose your changes), use
> @@ -5351,8 +5356,15 @@
>      if date and rev is not None:
>          raise error.Abort(_("you can't specify a revision and a date"))
>
> -    if check and clean:
> -        raise error.Abort(_("cannot specify both -c/--check and -C/--clean"))
> +    if len([x for x in (clean, check, merge) if x]) > 1:
> +        raise error.Abort(_("can only specify one of -C/--clean, -c/--check, "
> +                            "or -m/merge"))
> +
> +    updatecheck = None
> +    if check:
> +        updatecheck = 'abort'
> +    elif merge:
> +        updatecheck = 'none'
>
>      with repo.wlock():
>          cmdutil.clearunfinished(repo)
> @@ -5366,7 +5378,8 @@
>
>          repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
>
> -        return hg.updatetotally(ui, repo, rev, brev, clean=clean, check=check)
> +        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
> +                                updatecheck=updatecheck)
>
>  @command('verify', [])
>  def verify(ui, repo):
> diff -r 1ee685defe80 -r 19f471c81480 mercurial/hg.py
> --- a/mercurial/hg.py    Wed Feb 15 16:29:58 2017 -0800
> +++ b/mercurial/hg.py    Mon Feb 13 12:58:37 2017 -0800
> @@ -681,18 +681,19 @@
>      repo.ui.status(_("%d files updated, %d files merged, "
>                       "%d files removed, %d files unresolved\n") % stats)
>
> -def updaterepo(repo, node, overwrite):
> +def updaterepo(repo, node, overwrite, updatecheck=None):
>      """Update the working directory to node.
>
>      When overwrite is set, changes are clobbered, merged else
>
>      returns stats (see pydoc mercurial.merge.applyupdates)"""
>      return mergemod.update(repo, node, False, overwrite,
> -                           labels=['working copy', 'destination'])
> +                           labels=['working copy', 'destination'],
> +                           updatecheck=updatecheck)
>
> -def update(repo, node, quietempty=False):
> -    """update the working directory to node, merging linear changes"""
> -    stats = updaterepo(repo, node, False)
> +def update(repo, node, quietempty=False, updatecheck=None):
> +    """update the working directory to node"""
> +    stats = updaterepo(repo, node, False, updatecheck=updatecheck)
>      _showstats(repo, stats, quietempty)
>      if stats[3]:
>          repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
> @@ -712,7 +713,7 @@
>  # naming conflict in updatetotally()
>  _clean = clean
>
> -def updatetotally(ui, repo, checkout, brev, clean=False, check=False):
> +def updatetotally(ui, repo, checkout, brev, clean=False, updatecheck=None):
>      """Update the working directory with extra care for non-file components
>
>      This takes care of non-file components below:
> @@ -724,10 +725,19 @@
>      :checkout: to which revision the working directory is updated
>      :brev: a name, which might be a bookmark to be activated after updating
>      :clean: whether changes in the working directory can be discarded
> -    :check: whether changes in the working directory should be checked
> +    :updatecheck: how to deal with a dirty working directory
> +
> +    Valid values for updatecheck are (None => linear):
> +
> +     * abort: abort if the working directory is dirty
> +     * none: don't check (merge working directory changes into destination)
> +     * linear: check that update is linear before merging working directory
> +               changes into destination
>
>      This returns whether conflict is detected at updating or not.
>      """
> +    if updatecheck is None:
> +        updatecheck = 'linear'
>      with repo.wlock():
>          movemarkfrom = None
>          warndest = False
> @@ -739,9 +749,10 @@
>          if clean:
>              ret = _clean(repo, checkout)
>          else:
> -            if check:
> +            if updatecheck == 'abort':
>                  cmdutil.bailifchanged(repo, merge=False)
> -            ret = _update(repo, checkout)
> +                updatecheck = 'none'
> +            ret = _update(repo, checkout, updatecheck=updatecheck)
>
>          if not ret and movemarkfrom:
>              if movemarkfrom == repo['.'].node():
> diff -r 1ee685defe80 -r 19f471c81480 mercurial/merge.py
> --- a/mercurial/merge.py    Wed Feb 15 16:29:58 2017 -0800
> +++ b/mercurial/merge.py    Mon Feb 13 12:58:37 2017 -0800
> @@ -1444,7 +1444,8 @@
>              repo.dirstate.normal(f)
>
>  def update(repo, node, branchmerge, force, ancestor=None,
> -           mergeancestor=False, labels=None, matcher=None, mergeforce=False):
> +           mergeancestor=False, labels=None, matcher=None, mergeforce=False,
> +           updatecheck=None):
>      """
>      Perform a merge between the working directory and the given node
>
> @@ -1491,9 +1492,16 @@
>      Return the same tuple as applyupdates().
>      """
>
> -    # This functon used to find the default destination if node was None, but
> +    # This function used to find the default destination if node was None, but
>      # that's now in destutil.py.
>      assert node is not None
> +    if not branchmerge and not force:
> +        # TODO: remove the default once all callers that pass branchmerge=False
> +        # and force=False pass a value for updatecheck. We may want to allow
> +        # updatecheck='abort' to better suppport some of these callers.
> +        if updatecheck is None:
> +            updatecheck = 'linear'
> +        assert updatecheck in ('none', 'linear')
>      # 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,7 +1558,8 @@
>                  repo.hook('update', parent1=xp2, parent2='', error=0)
>                  return 0, 0, 0, 0
>
> -            if pas not in ([p1], [p2]):  # nonlinear
> +            if (updatecheck == 'linear' and
> +                    pas not in ([p1], [p2])):  # nonlinear
>                  dirty = wc.dirty(missing=True)
>                  if dirty:
>                      # Branching is a bit strange to ensure we do the minimal
> diff -r 1ee685defe80 -r 19f471c81480 tests/test-completion.t
> --- a/tests/test-completion.t    Wed Feb 15 16:29:58 2017 -0800
> +++ b/tests/test-completion.t    Mon Feb 13 12:58:37 2017 -0800
> @@ -223,7 +223,7 @@
>    serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate
>    status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
>    summary: remote
> -  update: clean, check, date, rev, tool
> +  update: clean, check, merge, date, rev, tool
>    addremove: similarity, subrepos, include, exclude, dry-run
>    archive: no-decode, prefix, rev, type, subrepos, include, exclude
>    backout: merge, commit, no-commit, parent, rev, edit, tool, include, exclude, message, logfile, date, user
> diff -r 1ee685defe80 -r 19f471c81480 tests/test-update-branches.t
> --- a/tests/test-update-branches.t    Wed Feb 15 16:29:58 2017 -0800
> +++ b/tests/test-update-branches.t    Mon Feb 13 12:58:37 2017 -0800
> @@ -160,6 +160,16 @@
>    parent=1
>    M foo
>
> +  $ revtest '-m dirty linear'   dirty 1 2 -m
> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  parent=2
> +  M foo
> +
> +  $ revtest '-m dirty cross'  dirty 3 4 -m
> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  parent=4
> +  M foo
> +
>    $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
>    abort: uncommitted changes in subrepository 'sub'
>    parent=1
> @@ -171,7 +181,17 @@
>    parent=2
>
>    $ revtest '-cC dirty linear'  dirty 1 2 -cC
> -  abort: cannot specify both -c/--check and -C/--clean
> +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> +  parent=1
> +  M foo
> +
> +  $ revtest '-mc dirty linear'  dirty 1 2 -mc
> +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> +  parent=1
> +  M foo
> +
> +  $ revtest '-mC dirty linear'  dirty 1 2 -mC
> +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
>    parent=1
>    M foo
>

_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1 of 4 V4] update: accept --merge to allow merging across topo branches (issue5125)

Martin von Zweigbergk via Mercurial-devel
On Tue, Feb 21, 2017 at 2:27 PM, Martin von Zweigbergk
<[hidden email]> wrote:
> Sure. I'm on vacation, so I can do that next week, or in a follow-up.
> Whichever the person considering queuing prefers.

I'm back from vacation. It's unclear if the series was not queued
because of Jun's comment or something else (maybe lack of time), but
I'm working on a V5 now. I hope to send that quite soon. Let me know
if there was another problem that held the series back.

>
>
> On Tue, Feb 21, 2017, 14:18 Jun Wu <[hidden email]> wrote:
>>
>> I like the behavior change (didn't check the implementation details
>> carefully).
>>
>> Could you also update the table in the docstring of merge.update? I think
>> that's very helpful to explain the behavior cleanly. Thanks!
>>
>> Excerpts from Martin von Zweigbergk's message of 2017-02-16 08:59:12
>> -0800:
>> > # HG changeset patch
>> > # User Martin von Zweigbergk <[hidden email]>
>> > # Date 1487019517 28800
>> > #      Mon Feb 13 12:58:37 2017 -0800
>> > # Node ID 19f471c814809099b5452b1174a2ecb0699cb76a
>> > # Parent  1ee685defe80117cf6aafea1ede6c33c478abceb
>> > update: accept --merge to allow merging across topo branches (issue5125)
>> >
>> > diff -r 1ee685defe80 -r 19f471c81480 mercurial/commands.py
>> > --- a/mercurial/commands.py    Wed Feb 15 16:29:58 2017 -0800
>> > +++ b/mercurial/commands.py    Mon Feb 13 12:58:37 2017 -0800
>> > @@ -5286,12 +5286,13 @@
>> >  @command('^update|up|checkout|co',
>> >      [('C', 'clean', None, _('discard uncommitted changes (no
>> > backup)')),
>> >      ('c', 'check', None, _('require clean working directory')),
>> > +    ('m', 'merge', None, _('merge local changes')),
>> >      ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
>> >      ('r', 'rev', '', _('revision'), _('REV'))
>> >       ] + mergetoolopts,
>> > -    _('[-C|-c] [-d DATE] [[-r] REV]'))
>> > +    _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
>> >  def update(ui, repo, node=None, rev=None, clean=False, date=None,
>> > check=False,
>> > -           tool=None):
>> > +           merge=None, tool=None):
>> >      """update working directory (or switch revisions)
>> >
>> >      Update the repository's working directory to the specified
>> > @@ -5310,8 +5311,8 @@
>> >
>> >      .. container:: verbose
>> >
>> > -      The -C/--clean and -c/--check options control what happens if the
>> > -      working directory contains uncommitted changes.
>> > +      The -C/--clean, -c/--check, and -m/--merge options control what
>> > +      happens if the working directory contains uncommitted changes.
>> >        At most of one of them can be specified.
>> >
>> >        1. If no option is specified, and if
>> > @@ -5323,10 +5324,14 @@
>> >           branch), the update is aborted and the uncommitted changes
>> >           are preserved.
>> >
>> > -      2. With the -c/--check option, the update is aborted and the
>> > +      2. With the -m/--merge option, the update is allowed even if the
>> > +         requested changeset is not an ancestor or descendant of
>> > +         the working directory's parent.
>> > +
>> > +      3. With the -c/--check option, the update is aborted and the
>> >           uncommitted changes are preserved.
>> >
>> > -      3. With the -C/--clean option, uncommitted changes are discarded
>> > and
>> > +      4. With the -C/--clean option, uncommitted changes are discarded
>> > and
>> >           the working directory is updated to the requested changeset.
>> >
>> >      To cancel an uncommitted merge (and lose your changes), use
>> > @@ -5351,8 +5356,15 @@
>> >      if date and rev is not None:
>> >          raise error.Abort(_("you can't specify a revision and a date"))
>> >
>> > -    if check and clean:
>> > -        raise error.Abort(_("cannot specify both -c/--check and
>> > -C/--clean"))
>> > +    if len([x for x in (clean, check, merge) if x]) > 1:
>> > +        raise error.Abort(_("can only specify one of -C/--clean,
>> > -c/--check, "
>> > +                            "or -m/merge"))
>> > +
>> > +    updatecheck = None
>> > +    if check:
>> > +        updatecheck = 'abort'
>> > +    elif merge:
>> > +        updatecheck = 'none'
>> >
>> >      with repo.wlock():
>> >          cmdutil.clearunfinished(repo)
>> > @@ -5366,7 +5378,8 @@
>> >
>> >          repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
>> >
>> > -        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
>> > check=check)
>> > +        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
>> > +                                updatecheck=updatecheck)
>> >
>> >  @command('verify', [])
>> >  def verify(ui, repo):
>> > diff -r 1ee685defe80 -r 19f471c81480 mercurial/hg.py
>> > --- a/mercurial/hg.py    Wed Feb 15 16:29:58 2017 -0800
>> > +++ b/mercurial/hg.py    Mon Feb 13 12:58:37 2017 -0800
>> > @@ -681,18 +681,19 @@
>> >      repo.ui.status(_("%d files updated, %d files merged, "
>> >                       "%d files removed, %d files unresolved\n") %
>> > stats)
>> >
>> > -def updaterepo(repo, node, overwrite):
>> > +def updaterepo(repo, node, overwrite, updatecheck=None):
>> >      """Update the working directory to node.
>> >
>> >      When overwrite is set, changes are clobbered, merged else
>> >
>> >      returns stats (see pydoc mercurial.merge.applyupdates)"""
>> >      return mergemod.update(repo, node, False, overwrite,
>> > -                           labels=['working copy', 'destination'])
>> > +                           labels=['working copy', 'destination'],
>> > +                           updatecheck=updatecheck)
>> >
>> > -def update(repo, node, quietempty=False):
>> > -    """update the working directory to node, merging linear changes"""
>> > -    stats = updaterepo(repo, node, False)
>> > +def update(repo, node, quietempty=False, updatecheck=None):
>> > +    """update the working directory to node"""
>> > +    stats = updaterepo(repo, node, False, updatecheck=updatecheck)
>> >      _showstats(repo, stats, quietempty)
>> >      if stats[3]:
>> >          repo.ui.status(_("use 'hg resolve' to retry unresolved file
>> > merges\n"))
>> > @@ -712,7 +713,7 @@
>> >  # naming conflict in updatetotally()
>> >  _clean = clean
>> >
>> > -def updatetotally(ui, repo, checkout, brev, clean=False, check=False):
>> > +def updatetotally(ui, repo, checkout, brev, clean=False,
>> > updatecheck=None):
>> >      """Update the working directory with extra care for non-file
>> > components
>> >
>> >      This takes care of non-file components below:
>> > @@ -724,10 +725,19 @@
>> >      :checkout: to which revision the working directory is updated
>> >      :brev: a name, which might be a bookmark to be activated after
>> > updating
>> >      :clean: whether changes in the working directory can be discarded
>> > -    :check: whether changes in the working directory should be checked
>> > +    :updatecheck: how to deal with a dirty working directory
>> > +
>> > +    Valid values for updatecheck are (None => linear):
>> > +
>> > +     * abort: abort if the working directory is dirty
>> > +     * none: don't check (merge working directory changes into
>> > destination)
>> > +     * linear: check that update is linear before merging working
>> > directory
>> > +               changes into destination
>> >
>> >      This returns whether conflict is detected at updating or not.
>> >      """
>> > +    if updatecheck is None:
>> > +        updatecheck = 'linear'
>> >      with repo.wlock():
>> >          movemarkfrom = None
>> >          warndest = False
>> > @@ -739,9 +749,10 @@
>> >          if clean:
>> >              ret = _clean(repo, checkout)
>> >          else:
>> > -            if check:
>> > +            if updatecheck == 'abort':
>> >                  cmdutil.bailifchanged(repo, merge=False)
>> > -            ret = _update(repo, checkout)
>> > +                updatecheck = 'none'
>> > +            ret = _update(repo, checkout, updatecheck=updatecheck)
>> >
>> >          if not ret and movemarkfrom:
>> >              if movemarkfrom == repo['.'].node():
>> > diff -r 1ee685defe80 -r 19f471c81480 mercurial/merge.py
>> > --- a/mercurial/merge.py    Wed Feb 15 16:29:58 2017 -0800
>> > +++ b/mercurial/merge.py    Mon Feb 13 12:58:37 2017 -0800
>> > @@ -1444,7 +1444,8 @@
>> >              repo.dirstate.normal(f)
>> >
>> >  def update(repo, node, branchmerge, force, ancestor=None,
>> > -           mergeancestor=False, labels=None, matcher=None,
>> > mergeforce=False):
>> > +           mergeancestor=False, labels=None, matcher=None,
>> > mergeforce=False,
>> > +           updatecheck=None):
>> >      """
>> >      Perform a merge between the working directory and the given node
>> >
>> > @@ -1491,9 +1492,16 @@
>> >      Return the same tuple as applyupdates().
>> >      """
>> >
>> > -    # This functon used to find the default destination if node was
>> > None, but
>> > +    # This function used to find the default destination if node was
>> > None, but
>> >      # that's now in destutil.py.
>> >      assert node is not None
>> > +    if not branchmerge and not force:
>> > +        # TODO: remove the default once all callers that pass
>> > branchmerge=False
>> > +        # and force=False pass a value for updatecheck. We may want to
>> > allow
>> > +        # updatecheck='abort' to better suppport some of these callers.
>> > +        if updatecheck is None:
>> > +            updatecheck = 'linear'
>> > +        assert updatecheck in ('none', 'linear')
>> >      # 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,7 +1558,8 @@
>> >                  repo.hook('update', parent1=xp2, parent2='', error=0)
>> >                  return 0, 0, 0, 0
>> >
>> > -            if pas not in ([p1], [p2]):  # nonlinear
>> > +            if (updatecheck == 'linear' and
>> > +                    pas not in ([p1], [p2])):  # nonlinear
>> >                  dirty = wc.dirty(missing=True)
>> >                  if dirty:
>> >                      # Branching is a bit strange to ensure we do the
>> > minimal
>> > diff -r 1ee685defe80 -r 19f471c81480 tests/test-completion.t
>> > --- a/tests/test-completion.t    Wed Feb 15 16:29:58 2017 -0800
>> > +++ b/tests/test-completion.t    Mon Feb 13 12:58:37 2017 -0800
>> > @@ -223,7 +223,7 @@
>> >    serve: accesslog, daemon, daemon-postexec, errorlog, port, address,
>> > prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates,
>> > style, ipv6, certificate
>> >    status: all, modified, added, removed, deleted, clean, unknown,
>> > ignored, no-status, copies, print0, rev, change, include, exclude, subrepos,
>> > template
>> >    summary: remote
>> > -  update: clean, check, date, rev, tool
>> > +  update: clean, check, merge, date, rev, tool
>> >    addremove: similarity, subrepos, include, exclude, dry-run
>> >    archive: no-decode, prefix, rev, type, subrepos, include, exclude
>> >    backout: merge, commit, no-commit, parent, rev, edit, tool, include,
>> > exclude, message, logfile, date, user
>> > diff -r 1ee685defe80 -r 19f471c81480 tests/test-update-branches.t
>> > --- a/tests/test-update-branches.t    Wed Feb 15 16:29:58 2017 -0800
>> > +++ b/tests/test-update-branches.t    Mon Feb 13 12:58:37 2017 -0800
>> > @@ -160,6 +160,16 @@
>> >    parent=1
>> >    M foo
>> >
>> > +  $ revtest '-m dirty linear'   dirty 1 2 -m
>> > +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> > +  parent=2
>> > +  M foo
>> > +
>> > +  $ revtest '-m dirty cross'  dirty 3 4 -m
>> > +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> > +  parent=4
>> > +  M foo
>> > +
>> >    $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
>> >    abort: uncommitted changes in subrepository 'sub'
>> >    parent=1
>> > @@ -171,7 +181,17 @@
>> >    parent=2
>> >
>> >    $ revtest '-cC dirty linear'  dirty 1 2 -cC
>> > -  abort: cannot specify both -c/--check and -C/--clean
>> > +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
>> > +  parent=1
>> > +  M foo
>> > +
>> > +  $ revtest '-mc dirty linear'  dirty 1 2 -mc
>> > +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
>> > +  parent=1
>> > +  M foo
>> > +
>> > +  $ revtest '-mC dirty linear'  dirty 1 2 -mC
>> > +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
>> >    parent=1
>> >    M foo
>> >
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 1 of 4 V4] update: accept --merge to allow merging across topo branches (issue5125)

Jun Wu
Excerpts from Martin von Zweigbergk's message of 2017-02-27 14:29:08 -0800:
> On Tue, Feb 21, 2017 at 2:27 PM, Martin von Zweigbergk
> <[hidden email]> wrote:
> > Sure. I'm on vacation, so I can do that next week, or in a follow-up.
> > Whichever the person considering queuing prefers.
>
> I'm back from vacation. It's unclear if the series was not queued
> because of Jun's comment or something else (maybe lack of time), but
> I'm working on a V5 now. I hope to send that quite soon. Let me know
> if there was another problem that held the series back.

I guess it's lack of manpower...
I'll try to do a more thorough review later.

>
> >
> >
> > On Tue, Feb 21, 2017, 14:18 Jun Wu <[hidden email]> wrote:
> >>
> >> I like the behavior change (didn't check the implementation details
> >> carefully).
> >>
> >> Could you also update the table in the docstring of merge.update? I think
> >> that's very helpful to explain the behavior cleanly. Thanks!
> >>
> >> Excerpts from Martin von Zweigbergk's message of 2017-02-16 08:59:12
> >> -0800:
> >> > # HG changeset patch
> >> > # User Martin von Zweigbergk <[hidden email]>
> >> > # Date 1487019517 28800
> >> > #      Mon Feb 13 12:58:37 2017 -0800
> >> > # Node ID 19f471c814809099b5452b1174a2ecb0699cb76a
> >> > # Parent  1ee685defe80117cf6aafea1ede6c33c478abceb
> >> > update: accept --merge to allow merging across topo branches (issue5125)
> >> >
> >> > diff -r 1ee685defe80 -r 19f471c81480 mercurial/commands.py
> >> > --- a/mercurial/commands.py    Wed Feb 15 16:29:58 2017 -0800
> >> > +++ b/mercurial/commands.py    Mon Feb 13 12:58:37 2017 -0800
> >> > @@ -5286,12 +5286,13 @@
> >> >  @command('^update|up|checkout|co',
> >> >      [('C', 'clean', None, _('discard uncommitted changes (no
> >> > backup)')),
> >> >      ('c', 'check', None, _('require clean working directory')),
> >> > +    ('m', 'merge', None, _('merge local changes')),
> >> >      ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
> >> >      ('r', 'rev', '', _('revision'), _('REV'))
> >> >       ] + mergetoolopts,
> >> > -    _('[-C|-c] [-d DATE] [[-r] REV]'))
> >> > +    _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
> >> >  def update(ui, repo, node=None, rev=None, clean=False, date=None,
> >> > check=False,
> >> > -           tool=None):
> >> > +           merge=None, tool=None):
> >> >      """update working directory (or switch revisions)
> >> >
> >> >      Update the repository's working directory to the specified
> >> > @@ -5310,8 +5311,8 @@
> >> >
> >> >      .. container:: verbose
> >> >
> >> > -      The -C/--clean and -c/--check options control what happens if the
> >> > -      working directory contains uncommitted changes.
> >> > +      The -C/--clean, -c/--check, and -m/--merge options control what
> >> > +      happens if the working directory contains uncommitted changes.
> >> >        At most of one of them can be specified.
> >> >
> >> >        1. If no option is specified, and if
> >> > @@ -5323,10 +5324,14 @@
> >> >           branch), the update is aborted and the uncommitted changes
> >> >           are preserved.
> >> >
> >> > -      2. With the -c/--check option, the update is aborted and the
> >> > +      2. With the -m/--merge option, the update is allowed even if the
> >> > +         requested changeset is not an ancestor or descendant of
> >> > +         the working directory's parent.
> >> > +
> >> > +      3. With the -c/--check option, the update is aborted and the
> >> >           uncommitted changes are preserved.
> >> >
> >> > -      3. With the -C/--clean option, uncommitted changes are discarded
> >> > and
> >> > +      4. With the -C/--clean option, uncommitted changes are discarded
> >> > and
> >> >           the working directory is updated to the requested changeset.
> >> >
> >> >      To cancel an uncommitted merge (and lose your changes), use
> >> > @@ -5351,8 +5356,15 @@
> >> >      if date and rev is not None:
> >> >          raise error.Abort(_("you can't specify a revision and a date"))
> >> >
> >> > -    if check and clean:
> >> > -        raise error.Abort(_("cannot specify both -c/--check and
> >> > -C/--clean"))
> >> > +    if len([x for x in (clean, check, merge) if x]) > 1:
> >> > +        raise error.Abort(_("can only specify one of -C/--clean,
> >> > -c/--check, "
> >> > +                            "or -m/merge"))
> >> > +
> >> > +    updatecheck = None
> >> > +    if check:
> >> > +        updatecheck = 'abort'
> >> > +    elif merge:
> >> > +        updatecheck = 'none'
> >> >
> >> >      with repo.wlock():
> >> >          cmdutil.clearunfinished(repo)
> >> > @@ -5366,7 +5378,8 @@
> >> >
> >> >          repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
> >> >
> >> > -        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
> >> > check=check)
> >> > +        return hg.updatetotally(ui, repo, rev, brev, clean=clean,
> >> > +                                updatecheck=updatecheck)
> >> >
> >> >  @command('verify', [])
> >> >  def verify(ui, repo):
> >> > diff -r 1ee685defe80 -r 19f471c81480 mercurial/hg.py
> >> > --- a/mercurial/hg.py    Wed Feb 15 16:29:58 2017 -0800
> >> > +++ b/mercurial/hg.py    Mon Feb 13 12:58:37 2017 -0800
> >> > @@ -681,18 +681,19 @@
> >> >      repo.ui.status(_("%d files updated, %d files merged, "
> >> >                       "%d files removed, %d files unresolved\n") %
> >> > stats)
> >> >
> >> > -def updaterepo(repo, node, overwrite):
> >> > +def updaterepo(repo, node, overwrite, updatecheck=None):
> >> >      """Update the working directory to node.
> >> >
> >> >      When overwrite is set, changes are clobbered, merged else
> >> >
> >> >      returns stats (see pydoc mercurial.merge.applyupdates)"""
> >> >      return mergemod.update(repo, node, False, overwrite,
> >> > -                           labels=['working copy', 'destination'])
> >> > +                           labels=['working copy', 'destination'],
> >> > +                           updatecheck=updatecheck)
> >> >
> >> > -def update(repo, node, quietempty=False):
> >> > -    """update the working directory to node, merging linear changes"""
> >> > -    stats = updaterepo(repo, node, False)
> >> > +def update(repo, node, quietempty=False, updatecheck=None):
> >> > +    """update the working directory to node"""
> >> > +    stats = updaterepo(repo, node, False, updatecheck=updatecheck)
> >> >      _showstats(repo, stats, quietempty)
> >> >      if stats[3]:
> >> >          repo.ui.status(_("use 'hg resolve' to retry unresolved file
> >> > merges\n"))
> >> > @@ -712,7 +713,7 @@
> >> >  # naming conflict in updatetotally()
> >> >  _clean = clean
> >> >
> >> > -def updatetotally(ui, repo, checkout, brev, clean=False, check=False):
> >> > +def updatetotally(ui, repo, checkout, brev, clean=False,
> >> > updatecheck=None):
> >> >      """Update the working directory with extra care for non-file
> >> > components
> >> >
> >> >      This takes care of non-file components below:
> >> > @@ -724,10 +725,19 @@
> >> >      :checkout: to which revision the working directory is updated
> >> >      :brev: a name, which might be a bookmark to be activated after
> >> > updating
> >> >      :clean: whether changes in the working directory can be discarded
> >> > -    :check: whether changes in the working directory should be checked
> >> > +    :updatecheck: how to deal with a dirty working directory
> >> > +
> >> > +    Valid values for updatecheck are (None => linear):
> >> > +
> >> > +     * abort: abort if the working directory is dirty
> >> > +     * none: don't check (merge working directory changes into
> >> > destination)
> >> > +     * linear: check that update is linear before merging working
> >> > directory
> >> > +               changes into destination
> >> >
> >> >      This returns whether conflict is detected at updating or not.
> >> >      """
> >> > +    if updatecheck is None:
> >> > +        updatecheck = 'linear'
> >> >      with repo.wlock():
> >> >          movemarkfrom = None
> >> >          warndest = False
> >> > @@ -739,9 +749,10 @@
> >> >          if clean:
> >> >              ret = _clean(repo, checkout)
> >> >          else:
> >> > -            if check:
> >> > +            if updatecheck == 'abort':
> >> >                  cmdutil.bailifchanged(repo, merge=False)
> >> > -            ret = _update(repo, checkout)
> >> > +                updatecheck = 'none'
> >> > +            ret = _update(repo, checkout, updatecheck=updatecheck)
> >> >
> >> >          if not ret and movemarkfrom:
> >> >              if movemarkfrom == repo['.'].node():
> >> > diff -r 1ee685defe80 -r 19f471c81480 mercurial/merge.py
> >> > --- a/mercurial/merge.py    Wed Feb 15 16:29:58 2017 -0800
> >> > +++ b/mercurial/merge.py    Mon Feb 13 12:58:37 2017 -0800
> >> > @@ -1444,7 +1444,8 @@
> >> >              repo.dirstate.normal(f)
> >> >
> >> >  def update(repo, node, branchmerge, force, ancestor=None,
> >> > -           mergeancestor=False, labels=None, matcher=None,
> >> > mergeforce=False):
> >> > +           mergeancestor=False, labels=None, matcher=None,
> >> > mergeforce=False,
> >> > +           updatecheck=None):
> >> >      """
> >> >      Perform a merge between the working directory and the given node
> >> >
> >> > @@ -1491,9 +1492,16 @@
> >> >      Return the same tuple as applyupdates().
> >> >      """
> >> >
> >> > -    # This functon used to find the default destination if node was
> >> > None, but
> >> > +    # This function used to find the default destination if node was
> >> > None, but
> >> >      # that's now in destutil.py.
> >> >      assert node is not None
> >> > +    if not branchmerge and not force:
> >> > +        # TODO: remove the default once all callers that pass
> >> > branchmerge=False
> >> > +        # and force=False pass a value for updatecheck. We may want to
> >> > allow
> >> > +        # updatecheck='abort' to better suppport some of these callers.
> >> > +        if updatecheck is None:
> >> > +            updatecheck = 'linear'
> >> > +        assert updatecheck in ('none', 'linear')
> >> >      # 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,7 +1558,8 @@
> >> >                  repo.hook('update', parent1=xp2, parent2='', error=0)
> >> >                  return 0, 0, 0, 0
> >> >
> >> > -            if pas not in ([p1], [p2]):  # nonlinear
> >> > +            if (updatecheck == 'linear' and
> >> > +                    pas not in ([p1], [p2])):  # nonlinear
> >> >                  dirty = wc.dirty(missing=True)
> >> >                  if dirty:
> >> >                      # Branching is a bit strange to ensure we do the
> >> > minimal
> >> > diff -r 1ee685defe80 -r 19f471c81480 tests/test-completion.t
> >> > --- a/tests/test-completion.t    Wed Feb 15 16:29:58 2017 -0800
> >> > +++ b/tests/test-completion.t    Mon Feb 13 12:58:37 2017 -0800
> >> > @@ -223,7 +223,7 @@
> >> >    serve: accesslog, daemon, daemon-postexec, errorlog, port, address,
> >> > prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates,
> >> > style, ipv6, certificate
> >> >    status: all, modified, added, removed, deleted, clean, unknown,
> >> > ignored, no-status, copies, print0, rev, change, include, exclude, subrepos,
> >> > template
> >> >    summary: remote
> >> > -  update: clean, check, date, rev, tool
> >> > +  update: clean, check, merge, date, rev, tool
> >> >    addremove: similarity, subrepos, include, exclude, dry-run
> >> >    archive: no-decode, prefix, rev, type, subrepos, include, exclude
> >> >    backout: merge, commit, no-commit, parent, rev, edit, tool, include,
> >> > exclude, message, logfile, date, user
> >> > diff -r 1ee685defe80 -r 19f471c81480 tests/test-update-branches.t
> >> > --- a/tests/test-update-branches.t    Wed Feb 15 16:29:58 2017 -0800
> >> > +++ b/tests/test-update-branches.t    Mon Feb 13 12:58:37 2017 -0800
> >> > @@ -160,6 +160,16 @@
> >> >    parent=1
> >> >    M foo
> >> >
> >> > +  $ revtest '-m dirty linear'   dirty 1 2 -m
> >> > +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> >> > +  parent=2
> >> > +  M foo
> >> > +
> >> > +  $ revtest '-m dirty cross'  dirty 3 4 -m
> >> > +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> >> > +  parent=4
> >> > +  M foo
> >> > +
> >> >    $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
> >> >    abort: uncommitted changes in subrepository 'sub'
> >> >    parent=1
> >> > @@ -171,7 +181,17 @@
> >> >    parent=2
> >> >
> >> >    $ revtest '-cC dirty linear'  dirty 1 2 -cC
> >> > -  abort: cannot specify both -c/--check and -C/--clean
> >> > +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> >> > +  parent=1
> >> > +  M foo
> >> > +
> >> > +  $ revtest '-mc dirty linear'  dirty 1 2 -mc
> >> > +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> >> > +  parent=1
> >> > +  M foo
> >> > +
> >> > +  $ revtest '-mC dirty linear'  dirty 1 2 -mC
> >> > +  abort: can only specify one of -C/--clean, -c/--check, or -m/merge
> >> >    parent=1
> >> >    M foo
> >> >
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Loading...