[PATCH 1 of 2] histedit: minor refactoring of createmarkers check

Laurent Charignon lcharignon at fb.com
Thu Jul 16 13:41:44 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1437070657 25200
#      Thu Jul 16 11:17:37 2015 -0700
# Node ID 58cb628ade7b1b89f9b91aded2aa0aff0ec49ed6
# Parent  0ed3fe503fe494cd25d682f9e9ca72b4d3fc76a6
histedit: minor refactoring of createmarkers check

We use a variable to store whether or not we can create obsolescence markers.
It makes the patch series more readable as we are going to reuse this
values in other places in the function.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -750,6 +750,7 @@ def _histedit(ui, repo, state, *freeargs
 
     replacements = []
     state.keep = opts.get('keep', False)
+    supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
 
     # rebuild state
     if goal == 'continue':
@@ -881,7 +882,7 @@ def _histedit(ui, repo, state, *freeargs
         if mapping:
             movebookmarks(ui, repo, mapping, state.topmost, ntm)
             # TODO update mq state
-        if obsolete.isenabled(repo, obsolete.createmarkersopt):
+        if supportsmarkers:
             markers = []
             # sort by revision number because it sound "right"
             for prec in sorted(mapping, key=repo.changelog.rev):


More information about the Mercurial-devel mailing list