Rev 212: Removed now un-needed do_patch from CommandRunner. in http://bzr.daniel-watkins.co.uk/pqm/abstract-patch

Daniel Watkins daniel at daniel-watkins.co.uk
Tue Jul 22 19:35:52 BST 2008


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

------------------------------------------------------------
revno: 212
revision-id: daniel at daniel-watkins.co.uk-20080722183423-eapvg922g9ou8yck
parent: daniel at daniel-watkins.co.uk-20080722182738-me0v1knbtrwodnq9
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: abstract-patch
timestamp: Tue 2008-07-22 19:34:23 +0100
message:
  Removed now un-needed do_patch from CommandRunner.
-------------- next part --------------
=== modified file 'pqm/script.py'
--- a/pqm/script.py	2008-07-22 18:27:38 +0000
+++ b/pqm/script.py	2008-07-22 18:34:23 +0000
@@ -1091,35 +1091,5 @@
         else:
             self.unrecognized.append(line)
 
-    def do_patch(self, sender, content):
-        # TODO: Tim Penhey, 2008-05-28
-        # Get rid of the imports from pqm module itself.
-        from pqm import gnupatch_path, popen_noshell_with_input
-
-        def is_patchline(line):
-            return line != '' and (line[0] in ('+', '-') or line[0:2] == '@@')
-        if content == []:
-            raise PQMException(self.sender, "Empty patch content")
-        if not is_patchline(content[0]):
-            summary = content[0]
-        else:
-            raise PQMException(self.sender, "No summary given for patch")
-        filenames = []
-        for line in content:
-            if line[0:4] in ('+++ ', '--- '):
-                # We intentionally include the date, etc - stripping it out is too hard and error-prone
-                filenames.insert(0, line[4:].strip())
-        for filename in filenames:
-            if (filename.find('/..') > 0) or (filename.find('../') > 0):
-                raise PQMException(self.sender, "Invalid backreferencing filename in patch: %s", filename)
-            elif filename[0] == '/':
-                raise PQMException(self.sender, "Invalid absolute filename in patch: %s", filename)
-        fd = self.write_lines_to_fd(content)
-        (status, msg, output) = popen_noshell_with_input(gnupatch_path, fd, '-p1', '--batch', '--no-backup-if-mismatch')
-        os.close(fd)
-        if not ((status is None) or (status == 0)):
-            raise PQMException(self.sender, ["patch command \"%s\" failed (%s): %s" % (gnupatch_path, status, msg)] + output)
-        return (summary, output)
-
     def getProjects(self):
         return set()



More information about the bazaar-commits mailing list