[PATCH 03 of 12] localrepo: add a method to create an arbitrary label

Sean Farley sean.michael.farley at gmail.com
Mon Aug 18 16:17:59 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1396218326 18000
#      Sun Mar 30 17:25:26 2014 -0500
# Node ID 8d39822184e18921690163fb4b5464e53d74f620
# Parent  997cc95ccdd7d74898e2aa52d4cadb1ad24ad0ef
localrepo: add a method to create an arbitrary label

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -713,10 +713,15 @@ class localrepository(object):
             # ensure a blank dictionary exists
             self._labels[namespace] = {}
             return True
         return False
 
+    def label(self, namespace, name, node):
+        '''Add a label to self._labels[namespace][name]'''
+        self._createlabelnamespace(namespace)
+        self._labels[namespace][name] = node
+
     def branchmap(self):
         '''returns a dictionary {branch: [branchheads]} with branchheads
         ordered by increasing revision number'''
         branchmap.updatecache(self)
         return self._branchcaches[self.filtername]


More information about the Mercurial-devel mailing list