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

login
register
mail settings
Submitter Sean Farley
Date Aug. 18, 2014, 9:17 p.m.
Message ID <8d39822184e189216901.1408396679@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/5461/
State Changes Requested
Headers show

Comments

Sean Farley - Aug. 18, 2014, 9:17 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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

Patch

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]