Patchwork [1,of,9,RFC] pushkey: reindent and document _namespaces

login
register
mail settings
Submitter Gregory Szorc
Date Aug. 14, 2016, 9:10 p.m.
Message ID <5aff57cb77481737c73a.1471209000@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/16282/
State Changes Requested
Headers show

Comments

Gregory Szorc - Aug. 14, 2016, 9:10 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1471203456 25200
#      Sun Aug 14 12:37:36 2016 -0700
# Node ID 5aff57cb77481737c73a0acd4885917985bfcf63
# Parent  279cd80059d41bbdb91ea9073278cbbe7f1b43d5
pushkey: reindent and document _namespaces

In preparation for tweaking it in subsequent commits.

Patch

diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -17,21 +17,24 @@  from . import (
 def _nslist(repo):
     n = {}
     for k in _namespaces:
         n[k] = ""
     if not obsolete.isenabled(repo, obsolete.exchangeopt):
         n.pop('obsolete')
     return n
 
-_namespaces = {"namespaces": (lambda *x: False, _nslist),
-               "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
-               "phases": (phases.pushphase, phases.listphases),
-               "obsolete": (obsolete.pushmarker, obsolete.listmarkers),
-              }
+# Maps pushkey namespace to a tuple defining functions to call for
+# setting and listing entries in the namespace.
+_namespaces = {
+    'namespaces': (lambda *x: False, _nslist),
+    'bookmarks': (bookmarks.pushbookmark, bookmarks.listbookmarks),
+    'phases': (phases.pushphase, phases.listphases),
+    'obsolete': (obsolete.pushmarker, obsolete.listmarkers),
+}
 
 def register(namespace, pushkey, listkeys):
     _namespaces[namespace] = (pushkey, listkeys)
 
 def _get(namespace):
     return _namespaces.get(namespace, (lambda *x: False, lambda *x: {}))
 
 def push(repo, namespace, key, old, new):