~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_patches.py

  • Committer: Colin Watson
  • Date: 2015-07-02 10:37:05 UTC
  • mto: This revision was merged to the branch mainline in revision 6605.
  • Revision ID: cjwatson@canonical.com-20150702103705-zdfslk3wb70sz37n
Avoid associating dirty patch headers with the previous file in the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        lines = ["=== added directory 'foo/bar'\n",
68
68
                 "=== modified file 'orig/commands.py'\n",
69
69
                 "--- orig/commands.py\n",
70
 
                 "+++ mod/dommands.py\n"]
 
70
                 "+++ mod/dommands.py\n",
 
71
                 "=== modified file 'orig/another.py'\n",
 
72
                 "--- orig/another.py\n",
 
73
                 "+++ mod/another.py\n"]
71
74
        patches = parse_patches(
72
75
            lines.__iter__(), allow_dirty=True, keep_dirty=True)
 
76
        self.assertEqual(2, len(patches))
73
77
        self.assertEqual(patches[0]['dirty_head'],
74
78
                         ["=== added directory 'foo/bar'\n",
75
79
                          "=== modified file 'orig/commands.py'\n"])
76
80
        self.assertEqual(patches[0]['patch'].get_header().splitlines(True),
77
81
                         ["--- orig/commands.py\n", "+++ mod/dommands.py\n"])
 
82
        self.assertEqual(patches[1]['dirty_head'],
 
83
                         ["=== modified file 'orig/another.py'\n"])
 
84
        self.assertEqual(patches[1]['patch'].get_header().splitlines(True),
 
85
                         ["--- orig/another.py\n", "+++ mod/another.py\n"])
78
86
 
79
87
    def testValidPatchHeader(self):
80
88
        """Parse a valid patch header"""