Rev 186: Added test for tagging using revno. in http://bzr.daniel-watkins.co.uk/pqm/tag

Daniel Watkins daniel at daniel-watkins.co.uk
Tue Jul 22 21:13:49 BST 2008


At http://bzr.daniel-watkins.co.uk/pqm/tag

------------------------------------------------------------
revno: 186
revision-id: daniel at daniel-watkins.co.uk-20080722201220-mgx9cjuezszfdqze
parent: daniel at daniel-watkins.co.uk-20080722195836-waxuq7vg3pcejsui
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: tag
timestamp: Tue 2008-07-22 21:12:20 +0100
message:
  Added test for tagging using revno.
-------------- next part --------------
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py	2008-07-22 18:19:39 +0000
+++ b/pqm/tests/test_pqm.py	2008-07-22 20:12:20 +0000
@@ -22,6 +22,7 @@
                         DebugCommand,
                         MergeCommand,
                         PatchCommand,
+                        TagCommand,
                        )
 
 sample_signed_message = dedent("""\
@@ -415,6 +416,38 @@
                          str(e))
 
 
+class TestTagCommand(TestCaseWithQueue):
+
+    def set_up(self):
+        # Create branch to be tagged
+        tree = self.make_branch_and_tree('foo')
+        configp = ConfigParser()
+        configp.add_section('foo')
+        self.getQueue(empty=True)
+        # Create PQM working directory
+        self.build_tree(['bar/'])
+        pqm.workdir = 'bar'
+        pqm.precommit_hook = []
+        return configp, tree
+
+    def get_tag_command(self, revision, tag):
+        configp, tree = self.set_up()
+        self.build_tree_contents([('foo/bar', '')])
+        tree.smart_add(['foo/bar'])
+        rev_id = tree.commit("Add bar.")
+        script = MockScript()
+        handler = pqm.BranchSpecOptionHandler(configp, queuedir='queue')
+        return (TagCommand(script, handler, configp, 'foo', revision, tag),
+                rev_id)
+
+    def test_TagCommand_revno(self):
+        from bzrlib.branch import Branch
+        command, rev_id = self.get_tag_command('1', 'tag')
+        command.run()
+        branch = Branch.open('foo')
+        self.assertEqual(branch.tags.lookup_tag('tag'), rev_id)
+
+
 class FunctionalTestCommandRunner(unittest.TestCase):
 
     def setUp(self):



More information about the bazaar-commits mailing list