Rev 206: Added test for patches with absolute paths, as well as fix thrown up by said test. in http://bzr.daniel-watkins.co.uk/pqm/abstract-patch
Daniel Watkins
daniel at daniel-watkins.co.uk
Tue Jul 22 18:35:56 BST 2008
At http://bzr.daniel-watkins.co.uk/pqm/abstract-patch
------------------------------------------------------------
revno: 206
revision-id: daniel at daniel-watkins.co.uk-20080722173426-7we2a37o6gbirsy2
parent: daniel at daniel-watkins.co.uk-20080722172630-kumd4al0u7eaum6b
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: abstract-patch
timestamp: Tue 2008-07-22 18:34:26 +0100
message:
Added test for patches with absolute paths, as well as fix thrown up by said test.
-------------- next part --------------
=== modified file 'pqm/script.py'
--- a/pqm/script.py 2008-07-22 17:26:30 +0000
+++ b/pqm/script.py 2008-07-22 17:34:26 +0000
@@ -742,8 +742,8 @@
msg = "Invalid backreferencing filename in patch: %s"
raise PQMException(self.sender, msg, filename)
elif filename[0] == '/':
- msg = "Invalid absolute filename in patch: %s"
- raise PQMException(self.sender, msg, filename)
+ msg = "Invalid absolute filename in patch: %s" % (filename,)
+ raise PQMException(self.sender, msg)
fd = self.write_lines_to_fd(content)
status, msg, output = \
popen_noshell_with_input(gnupatch_path, fd, '-p1', '--batch',
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py 2008-07-22 17:15:33 +0000
+++ b/pqm/tests/test_pqm.py 2008-07-22 17:34:26 +0000
@@ -399,6 +399,21 @@
" input.\\n']",
str(e))
+ def test_PatchCommand_absolute_path(self):
+ configp, tree = self.set_up()
+ patch = ["=== modified file 'bar'",
+ "--- /bar 2008-07-20 16:06:44.000000000 +0100",
+ "+++ /bar 2008-07-20 16:06:48.000000000 +0100",
+ "@@ -0,0 +1 @@",
+ "+foo"]
+ script = MockScript()
+ handler = pqm.BranchSpecOptionHandler(configp, queuedir='queue')
+ command = PatchCommand(script, handler, configp, patch, 'foo')
+ e = self.assertRaises(PQMException, command.run)
+ self.assert_("Invalid absolute filename in patch: /bar 2008-07-20"
+ " 16:06:48.000000000 +0100",
+ str(e))
+
class FunctionalTestCommandRunner(unittest.TestCase):
More information about the bazaar-commits
mailing list