Rev 181: Readded replay merge as ReplayMergeCommand. in http://bzr.daniel-watkins.co.uk/pqm/merge-directives

Daniel Watkins daniel at daniel-watkins.co.uk
Sat Aug 23 22:59:19 BST 2008


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

------------------------------------------------------------
revno: 181
revision-id: daniel at daniel-watkins.co.uk-20080823215721-qmh7jiu5ctv5nz3i
parent: daniel at daniel-watkins.co.uk-20080823214227-vsdg7gs5ssy8d7y7
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: merge-directives
timestamp: Sat 2008-08-23 22:57:21 +0100
message:
  Readded replay merge as ReplayMergeCommand.
-------------- next part --------------
=== modified file 'pqm/__init__.py'
--- a/pqm/__init__.py	2008-08-23 21:17:14 +0000
+++ b/pqm/__init__.py	2008-08-23 21:57:21 +0000
@@ -218,6 +218,9 @@
     def do_star_merge(self, sender, from_branch, local_dir):
         raise PQMTlaFailure(sender, 'Unsupported operation')
 
+    def do_replay(self, sender, from_branch, local_dir):
+        raise PQMTlaFailure(sender, 'Unsupported operation')
+
     def do_repo_cache(self, sender, fromrepo, fromrevision):
         raise PQMTlaFailure(sender, 'Unsupported operation')
     
@@ -258,6 +261,10 @@
         self.run_in_dir(dir, runtla, sender, 'commit', '-s', summary)
         logger.info("commit succeeded")
 
+    def do_replay(self, sender, from_branch, local_dir):
+        return self.run_in_dir(local_dir, runtla, sender, 'replay',
+                               '%s' % from_branch)
+
     def do_whereis_repo(self, sender, repo):
         return runtla(sender, 'whereis-archive', '%s' % (repo))
     

=== modified file 'pqm/script.py'
--- a/pqm/script.py	2008-08-23 21:42:27 +0000
+++ b/pqm/script.py	2008-08-23 21:57:21 +0000
@@ -81,6 +81,7 @@
     pgp_re = re.compile('^-----BEGIN PGP.*MESSAGE')
     pgp_end_re = re.compile('^-----BEGIN PGP SIG')
     # parser for merge recognition
+    replay_re = re.compile('^replay (\S+/\S+)\s+(\S+/\S+)\s*$')
     star_re = re.compile('^star-merge (\S+/\S+)\s+(\S+/\S+)\s*$')
     # parse matcher for the debug command
     debug_re = re.compile('^debug')
@@ -213,9 +214,10 @@
             if not self.isCommand(line):
                 continue
             # identify and construct commands
+            debug_match = Script.debug_re.match(line)
+            replay_match = Script.replay_re.match(line)
             star_match = Script.star_re.match(line)
-            debug_match = Script.debug_re.match(line)
-            any_match = star_match or debug_match
+            any_match = debug_match or replay_match or star_match
             if any_match and legacy_lines:
                 result.append(CommandRunner(self,
                                             self._branch_spec_handler,
@@ -233,6 +235,12 @@
                 result.append(DebugCommand(self,
                                            self._branch_spec_handler,
                                            self._configp))
+            elif replay_match:
+                result.append(ReplayMergeCommand(self,
+                                                 self._branch_spec_handler,
+                                                 self._configp,
+                                                 replay_match.group(1),
+                                                 replay_match.group(2)))
             else:
                 legacy_lines.append(line)
         if legacy_lines:
@@ -734,6 +742,26 @@
                 self.bundle == other.bundle)
 
 
+class ReplayMergeCommand(MergeCommand):
+
+    def asHTML(self):
+        return cgi.escape("Replay %s %s" % (self.from_branch,
+                                            self.to_branch))
+
+    def run(self):
+        super(MergeCommand, self).run()
+        self.cleanup_wd()
+        self.do_merge(from_repo_revision=self.from_branch,
+                      to_repo_revision=self.to_branch,
+                      merge_name='replay',
+                      line='replay %s %s' % (self.from_branch,
+                                             self.to_branch))
+        return self.successful, self.unrecognized, self.output
+
+    def _do_merge(self, sender, dir):
+        return self.get_vcs().do_replay(sender, self.from_branch, dir)
+
+
 class PrecommitCommand(Command):
     """A pre-commit command."""
 



More information about the bazaar-commits mailing list