hgweb: extract constant to global level
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Mon, 03 Dec 2007 12:06:21 +0100
changeset 5597 e7f99a3ed008
parent 5596 20b07b68a865
child 5598 d534ba1c4eb4
hgweb: extract constant to global level
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Mon Dec 03 11:58:52 2007 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Dec 03 12:06:21 2007 +0100
@@ -14,6 +14,21 @@
 from request import wsgirequest
 import webcommands
 
+shortcuts = {
+    'cl': [('cmd', ['changelog']), ('rev', None)],
+    'sl': [('cmd', ['shortlog']), ('rev', None)],
+    'cs': [('cmd', ['changeset']), ('node', None)],
+    'f': [('cmd', ['file']), ('filenode', None)],
+    'fl': [('cmd', ['filelog']), ('filenode', None)],
+    'fd': [('cmd', ['filediff']), ('node', None)],
+    'fa': [('cmd', ['annotate']), ('filenode', None)],
+    'mf': [('cmd', ['manifest']), ('manifest', None)],
+    'ca': [('cmd', ['archive']), ('node', None)],
+    'tags': [('cmd', ['tags'])],
+    'tip': [('cmd', ['changeset']), ('node', ['tip'])],
+    'static': [('cmd', ['static']), ('file', None)]
+}
+
 def _up(p):
     if p[0] != "/":
         p = "/" + p
@@ -123,21 +138,6 @@
 
         # expand form shortcuts
 
-        shortcuts = {
-            'cl': [('cmd', ['changelog']), ('rev', None)],
-            'sl': [('cmd', ['shortlog']), ('rev', None)],
-            'cs': [('cmd', ['changeset']), ('node', None)],
-            'f': [('cmd', ['file']), ('filenode', None)],
-            'fl': [('cmd', ['filelog']), ('filenode', None)],
-            'fd': [('cmd', ['filediff']), ('node', None)],
-            'fa': [('cmd', ['annotate']), ('filenode', None)],
-            'mf': [('cmd', ['manifest']), ('manifest', None)],
-            'ca': [('cmd', ['archive']), ('node', None)],
-            'tags': [('cmd', ['tags'])],
-            'tip': [('cmd', ['changeset']), ('node', ['tip'])],
-            'static': [('cmd', ['static']), ('file', None)]
-        }
-
         for k in shortcuts.iterkeys():
             if k in req.form:
                 for name, value in shortcuts[k]: