Rev 6605: (vila) Avoid associating dirty patch headers with the previous file in the in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Wed Sep 30 16:43:22 UTC 2015


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6605 [merge]
revision-id: pqm at pqm.ubuntu.com-20150930164321-ct2v2qnmvimqt8qf
parent: pqm at pqm.ubuntu.com-20150910081753-773xpy9je7uafytx
parent: cjwatson at canonical.com-20150702113047-359s4zsi07wvfwso
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2015-09-30 16:43:21 +0000
message:
  (vila) Avoid associating dirty patch headers with the previous file in the
   patch. (Colin Watson)
modified:
  bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
  bzrlib/tests/test_patches.py   test_patches.py-20051231203844-f4974d20f6aea09c
=== modified file 'bzrlib/patches.py'
--- a/bzrlib/patches.py	2014-12-12 03:59:25 +0000
+++ b/bzrlib/patches.py	2015-07-02 10:37:05 +0000
@@ -358,6 +358,14 @@
 
     for line in iter_lines:
         if line.startswith('=== '):
+            if len(saved_lines) > 0:
+                if keep_dirty and len(dirty_head) > 0:
+                    yield {'saved_lines': saved_lines,
+                           'dirty_head': dirty_head}
+                    dirty_head = []
+                else:
+                    yield saved_lines
+                saved_lines = []
             dirty_head.append(line)
             continue
         if line.startswith('*** '):

=== modified file 'bzrlib/tests/test_patches.py'
--- a/bzrlib/tests/test_patches.py	2014-12-12 03:59:25 +0000
+++ b/bzrlib/tests/test_patches.py	2015-07-02 11:30:47 +0000
@@ -67,14 +67,22 @@
         lines = ["=== added directory 'foo/bar'\n",
                  "=== modified file 'orig/commands.py'\n",
                  "--- orig/commands.py\n",
-                 "+++ mod/dommands.py\n"]
+                 "+++ mod/dommands.py\n",
+                 "=== modified file 'orig/another.py'\n",
+                 "--- orig/another.py\n",
+                 "+++ mod/another.py\n"]
         patches = parse_patches(
             lines.__iter__(), allow_dirty=True, keep_dirty=True)
+        self.assertLength(2, patches)
         self.assertEqual(patches[0]['dirty_head'],
                          ["=== added directory 'foo/bar'\n",
                           "=== modified file 'orig/commands.py'\n"])
         self.assertEqual(patches[0]['patch'].get_header().splitlines(True),
                          ["--- orig/commands.py\n", "+++ mod/dommands.py\n"])
+        self.assertEqual(patches[1]['dirty_head'],
+                         ["=== modified file 'orig/another.py'\n"])
+        self.assertEqual(patches[1]['patch'].get_header().splitlines(True),
+                         ["--- orig/another.py\n", "+++ mod/another.py\n"])
 
     def testValidPatchHeader(self):
         """Parse a valid patch header"""




More information about the bazaar-commits mailing list