changeset 3402:7a322f58fee3

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].
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 11 Jan 2018 18:07:09 +0530
parents 43b7773e00ae
children 73920cb25af3 39112fd4d5ed
files hgext3rd/evolve/obshistory.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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):