obshistory: pass the csets description in getmarkerdescriptionpatch
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 11 Jan 2018 18:07:09 +0530
changeset 3402 7a322f58fee3
parent 3401 43b7773e00ae
child 3403 73920cb25af3
child 3410 39112fd4d5ed
obshistory: pass the csets description in getmarkerdescriptionpatch Previous patches removed any use of ctx in the function and we now just need the cset description in the function. Let's pass that only. This will save couple of calls of repo[node].
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Thu Jan 11 17:54:34 2018 +0530
+++ b/hgext3rd/evolve/obshistory.py	Thu Jan 11 18:07:09 2018 +0530
@@ -163,13 +163,11 @@
 
     return True, succ
 
-def getmarkerdescriptionpatch(repo, base, succ):
-    basectx = repo[base]
-    succctx = repo[succ]
+def getmarkerdescriptionpatch(repo, basedesc, succdesc):
     # description are stored without final new line,
     # add one to avoid ugly diff
-    basedesc = basectx.description() + '\n'
-    succdesc = succctx.description() + '\n'
+    basedesc += '\n'
+    succdesc += '\n'
 
     # fake file name
     basename = "changeset-description"
@@ -496,13 +494,17 @@
         if _patchavailable[0] is True:
             succ = _patchavailable[1]
 
+            basectx = repo[node]
+            succctx = repo[succ]
             # Description patch
-            descriptionpatch = getmarkerdescriptionpatch(repo, node, succ)
+            descriptionpatch = getmarkerdescriptionpatch(repo,
+                                                         basectx.description(),
+                                                         succctx.description())
 
             if descriptionpatch:
                 # add the diffheader
                 diffheader = "diff -r %s -r %s changeset-description\n" % \
-                             (repo[node], repo[succ])
+                             (basectx, succctx)
                 descriptionpatch = diffheader + descriptionpatch
 
                 def tolist(text):