[PATCH 3 of 7] tags: reorder argument of '_updatetags'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 28 02:16:58 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1490679490 -7200
#      Tue Mar 28 07:38:10 2017 +0200
# Node ID f0c93dd8d018c9f6828c97be8ccb80dbfca694b8
# Parent  147b98bfa4afbaf608d9e1f5227a48a46e386ea4
# EXP-Topic tags
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r f0c93dd8d018
tags: reorder argument of '_updatetags'

We move all arguments related to tagtype at the end, together. This will allow
us to make these argument optional. This will be useful to reuse this logic for
caller that do not care about the tag types.

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -97,7 +97,7 @@ def findglobaltags(ui, repo):
         # XXX is this really 100% correct?  are there oddball special
         # cases where a global tag should outrank a local tag but won't,
         # because cachetags does not contain rank info?
-        _updatetags(cachetags, 'global', alltags, tagtypes)
+        _updatetags(cachetags, alltags, 'global', tagtypes)
         return alltags, tagtypes
 
     seen = set()  # set of fnode
@@ -115,7 +115,7 @@ def findglobaltags(ui, repo):
                 fctx = fctx.filectx(fnode)
 
             filetags = _readtags(ui, repo, fctx.data().splitlines(), fctx)
-            _updatetags(filetags, 'global', alltags, tagtypes)
+            _updatetags(filetags, alltags, 'global', tagtypes)
 
     # and update the cache (if necessary)
     if shouldwrite:
@@ -145,7 +145,7 @@ def readlocaltags(ui, repo, alltags, tag
         except (LookupError, ValueError):
             del filetags[t]
 
-    _updatetags(filetags, "local", alltags, tagtypes)
+    _updatetags(filetags, alltags, 'local', tagtypes)
 
 def _readtaghist(ui, repo, lines, fn, recode=None, calcnodelines=False):
     '''Read tag definitions from a file (or any source of lines).
@@ -223,7 +223,7 @@ def _readtags(ui, repo, lines, fn, recod
         newtags[tag] = (taghist[-1], taghist[:-1])
     return newtags
 
-def _updatetags(filetags, tagtype, alltags, tagtypes):
+def _updatetags(filetags, alltags, tagtype, tagtypes):
     '''Incorporate the tag info read from one file into the two
     dictionaries, alltags and tagtypes, that contain all tag
     info (global across all heads plus local).'''


More information about the Mercurial-devel mailing list