evolvecmd: introduce fn to be wrapped by extensions resolving content-div
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 08 Jul 2018 22:16:17 +0530
changeset 3879 1fa3bf6e9e93
parent 3878 dc2b53b3573f
child 3881 9cf45b94f977
evolvecmd: introduce fn to be wrapped by extensions resolving content-div The function added will be used by extension by wrapping it and adding logic to merge data introduced by them. For example: topic extension can wrap this function and add logic to merge topic names.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Sun Jul 08 21:18:33 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Jul 08 22:16:17 2018 +0530
@@ -549,6 +549,8 @@
         # new node if any formed as the replacement
         newnode = None
 
+        mergehook(repo, base, divergent, other)
+
         newnode = repo.commit(text=desc, user=repo.ui.username())
         if newnode == divergent.node() or newnode is None:
             # no changes
@@ -643,6 +645,11 @@
     # this function only
     cmdrewrite._uncommitdirstate(repo, oldparent, match, True)
 
+def mergehook(repo, base, divergent, other):
+    """function which extensions can wrap and merge data introduced by them
+    while resolving content-divergence"""
+    pass
+
 def mergebranches(repo, divergent, other, base):
     """merges the branch information for content-divergent changesets and sets
     the dirstate branch accordingly