Rev 209: Started adding 'check_is_valid' methods to Commands. in http://bzr.daniel-watkins.co.uk/pqm/xmlrpc

Daniel Watkins daniel at daniel-watkins.co.uk
Fri Aug 1 02:55:04 BST 2008


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

------------------------------------------------------------
revno: 209
revision-id: daniel at daniel-watkins.co.uk-20080801015327-rl0g2fp2asiomo3q
parent: daniel at daniel-watkins.co.uk-20080801012902-uu80g28tad7xmhjl
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: xmlrpc-validation
timestamp: Fri 2008-08-01 02:53:27 +0100
message:
  Started adding 'check_is_valid' methods to Commands.
-------------- next part --------------
=== modified file 'pqm/script.py'
--- a/pqm/script.py	2008-07-31 06:17:16 +0000
+++ b/pqm/script.py	2008-08-01 01:53:27 +0000
@@ -623,6 +623,9 @@
         except PQMTlaFailure, e:
             raise PQMCmdFailure(sender, self.successful, line, self.output + e.output)
 
+    def check_is_valid(self):
+        return True  # Commands are valid by default
+
 
 class DebugCommand(Command):
     """Turns on debug mode."""
@@ -653,6 +656,7 @@
         super(MergeCommand, self).__init__(script, branch_spec_handler, configp)
         self.from_branch = from_branch
         self.to_branch = to_branch
+        self.line = "merge %s %s" % (self.from_branch, self.to_branch)
 
     def asHTML(self):
         return cgi.escape("Merge %s %s" % (self.from_branch, self.to_branch))
@@ -678,9 +682,14 @@
                       to_repo_revision=self.to_branch,
                       merge_name='star-merge',
                       merge_method="do_star_merge",
-                      line='merge %s %s' % (self.from_branch, self.to_branch))
+                      line=self.line)
         return self.successful, self.unrecognized, self.output
 
+    def check_is_valid(self):
+        self.check_target(self.to_branch, self.line)
+        b, config = self.getBranchConfig(self.to_branch)
+        self.check_commit_regex(to_branch, config)
+
 
 class PrecommitCommand(Command):
     """A pre-commit command."""



More information about the bazaar-commits mailing list