Patchwork D8168: merge: introduce a merge() for that use-case

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2020, 7:15 p.m.
Message ID <differential-rev-PHID-DREV-l2hsdau6vxmzsndut7an-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45351/
State Superseded
Headers show

Comments

phabricator - Feb. 26, 2020, 7:15 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In the same vein as some earlier patches like f546d2170b0f <https://phab.mercurial-scm.org/rHGf546d2170b0fedca9eeac331f11b34a7abc6e25b> (merge:
  introduce a clean_update() for that use-case, 2020-01-15).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8168

AFFECTED FILES
  mercurial/commands.py
  mercurial/hg.py
  mercurial/merge.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 27, 2020, 7:44 a.m.
pulkit added inline comments.

INLINE COMMENTS

> commands.py:4912
>          labels = [b'working copy', b'merge rev']
> -        return hg.merge(
> -            repo, node, force=force, labels=labels
> -        )
> +        return hg.merge(repo, node, force=force, labels=labels)
>  

This seems like unrelated change and should be part of previous patch.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8168/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8168

To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Feb. 27, 2020, 4:36 p.m.
martinvonz added a comment.


  Moved formatting fix to parent patch

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8168/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8168

To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2597,6 +2597,23 @@ 
     return stats
 
 
+def merge(ctx, labels=None, force=False, wc=None):
+    """Merge in another topological branch.
+
+    force = whether the merge was run with 'merge --force' (deprecated)
+    """
+
+    return update(
+        ctx.repo(),
+        ctx.rev(),
+        labels=labels,
+        branchmerge=True,
+        force=force,
+        mergeforce=force,
+        wc=wc,
+    )
+
+
 def clean_update(ctx, wc=None):
     """Do a clean update to the given commit.
 
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1141,14 +1141,7 @@ 
 ):
     """Branch merge with node, resolving changes. Return true if any
     unresolved conflicts."""
-    stats = mergemod.update(
-        repo,
-        node,
-        branchmerge=True,
-        force=force,
-        mergeforce=force,
-        labels=labels,
-    )
+    stats = mergemod.merge(repo[node], force=force, labels=labels,)
     _showstats(repo, stats)
     if stats.unresolvedcount:
         repo.ui.status(
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4909,9 +4909,7 @@ 
     with ui.configoverride(overrides, b'merge'):
         force = opts.get(b'force')
         labels = [b'working copy', b'merge rev']
-        return hg.merge(
-            repo, node, force=force, labels=labels
-        )
+        return hg.merge(repo, node, force=force, labels=labels)
 
 
 statemod.addunfinished(