Patchwork [1,of,2] style: don't use capital letter for constant

login
register
mail settings
Submitter Pierre-Yves David
Date June 6, 2016, 4:43 a.m.
Message ID <44c4dca6edbece04ec77.1465188239@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/15419/
State Accepted
Headers show

Comments

Pierre-Yves David - June 6, 2016, 4:43 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1460847570 25200
#      Sat Apr 16 15:59:30 2016 -0700
# Node ID 44c4dca6edbece04ec77f7010157f5bbd50b6a63
# Parent  118a605e3ad9e1d30c4fd8bacc8310167ae1f222
# EXP-Topic style
style: don't use capital letter for constant

For better or worse, our coding do not use all caps for constants. We rename
constant name introduced in a5009789960c.

Patch

diff -r 118a605e3ad9 -r 44c4dca6edbe mercurial/transaction.py
--- a/mercurial/transaction.py	Thu May 26 17:36:44 2016 -0700
+++ b/mercurial/transaction.py	Sat Apr 16 15:59:30 2016 -0700
@@ -32,9 +32,9 @@  postfinalizegenerators = set([
 ])
 
 class GenerationGroup(object):
-    ALL='all'
-    PREFINALIZE='prefinalize'
-    POSTFINALIZE='postfinalize'
+    all='all'
+    prefinalize='prefinalize'
+    postfinalize='postfinalize'
 
 def active(func):
     def _active(self, *args, **kwds):
@@ -289,7 +289,7 @@  class transaction(object):
         # but for bookmarks that are handled outside this mechanism.
         self._filegenerators[genid] = (order, filenames, genfunc, location)
 
-    def _generatefiles(self, suffix='', group=GenerationGroup.ALL):
+    def _generatefiles(self, suffix='', group=GenerationGroup.all):
         # write files registered for generation
         any = False
         for id, entry in sorted(self._filegenerators.iteritems()):
@@ -297,8 +297,8 @@  class transaction(object):
             order, filenames, genfunc, location = entry
 
             # for generation at closing, check if it's before or after finalize
-            postfinalize = group == GenerationGroup.POSTFINALIZE
-            if (group != GenerationGroup.ALL and
+            postfinalize = group == GenerationGroup.postfinalize
+            if (group != GenerationGroup.all and
                 (id in postfinalizegenerators) != (postfinalize)):
                 continue
 
@@ -427,13 +427,13 @@  class transaction(object):
         '''commit the transaction'''
         if self.count == 1:
             self.validator(self)  # will raise exception if needed
-            self._generatefiles(group=GenerationGroup.PREFINALIZE)
+            self._generatefiles(group=GenerationGroup.prefinalize)
             categories = sorted(self._finalizecallback)
             for cat in categories:
                 self._finalizecallback[cat](self)
             # Prevent double usage and help clear cycles.
             self._finalizecallback = None
-            self._generatefiles(group=GenerationGroup.POSTFINALIZE)
+            self._generatefiles(group=GenerationGroup.postfinalize)
 
         self.count -= 1
         if self.count != 0: