Patchwork [10,of,13] merge: document return values of manifestmerge() and calculateupdates()

login
register
mail settings
Submitter Pulkit Goyal
Date July 17, 2020, 8:59 a.m.
Message ID <6a87141b0721d719fcc3.1594976371@workspace>
Download mbox | patch
Permalink /patch/46783/
State Accepted
Headers show

Comments

Pulkit Goyal - July 17, 2020, 8:59 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1594721548 -19800
#      Tue Jul 14 15:42:28 2020 +0530
# Node ID 6a87141b0721d719fcc3b8bb94743eda1a120c17
# Parent  15d0b77c5833af7c1b04e29dd4628a66d9518cde
# EXP-Topic mergestate-refactor
merge: document return values of manifestmerge() and calculateupdates()

In future patches, I want to add one more return value which represents
information which needs to stored and used at commit time.

Differential Revision: https://phab.mercurial-scm.org/D8741
Yuya Nishihara - July 19, 2020, 9:56 a.m.
On Fri, 17 Jul 2020 14:29:31 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1594721548 -19800
> #      Tue Jul 14 15:42:28 2020 +0530
> # Node ID 6a87141b0721d719fcc3b8bb94743eda1a120c17
> # Parent  15d0b77c5833af7c1b04e29dd4628a66d9518cde
> # EXP-Topic mergestate-refactor
> merge: document return values of manifestmerge() and calculateupdates()

Queued up to this patch, thanks.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -558,6 +558,13 @@  def manifestmerge(
     branchmerge and force are as passed in to update
     matcher = matcher to filter file lists
     acceptremote = accept the incoming changes without prompting
+
+    Returns:
+
+    actions: dict of filename as keys and action related info as values
+    diverge: mapping of source name -> list of dest name for divergent renames
+    renamedelete: mapping of source name -> list of destinations for files
+                  deleted on one side and renamed on other.
     """
     if matcher is not None and matcher.always():
         matcher = None
@@ -875,7 +882,17 @@  def calculateupdates(
     matcher=None,
     mergeforce=False,
 ):
-    """Calculate the actions needed to merge mctx into wctx using ancestors"""
+    """
+    Calculate the actions needed to merge mctx into wctx using ancestors
+
+    Uses manifestmerge() to merge manifest and get list of actions required to
+    perform for merging two manifests. If there are multiple ancestors, uses bid
+    merge if enabled.
+
+    Also filters out actions which are unrequired if repository is sparse.
+
+    Returns same 3 element tuple as manifestmerge().
+    """
     # Avoid cycle.
     from . import sparse