Commits

Fredrik Håård committed 853ab9f

Multiple tags to hg_tags, #13

  • Participants
  • Parent commits 63bdeb5

Comments (0)

Files changed (2)

File hgapi/hgapi.py

         if clean: cmd.append("--clean")
         self.hg_command(*cmd)
 
-    def hg_tag(self, name, rev=None):
-        """Add a tag to the current or given revision"""
-        cmd = ['tag', name]
+    def hg_tag(self, *tags, **kwargs):
+        """Add one or more tags to the current revision, or revision given by
+        passing 'rev' as a keyword argument::
+          
+          >>> repo.hg_tag('mytag', rev=3)"""
+        rev = kwargs.get('rev')
+        cmd = ['tag'] + list(tags)
         if rev: cmd += ['-r', str(rev)]
         self.hg_command(*cmd)
 

File hgapi/testhgapi.py

 
     def test_210_Tags(self):
         original_tip = self.repo['tip'].node
-        self.repo.hg_tag('mytag')
+        self.repo.hg_tag('mytag', 'othertag')
         self.repo.hg_tag('mytag2', rev=1)
         tags = self.repo.hg_tags()
         self.assertEqual(tags, {'mytag': original_tip,
+            'othertag': original_tip,
             'mytag2': self.repo[1].node,
             'tip': self.repo[-1].node})