diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-05-26 16:30:29 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-05-26 16:30:29 +0200 |
commit | 762ebe190b3a48df20f0b4bdce399819db65ff89 (patch) | |
tree | 05175b8732c7c3b6712e86510b455ea0842bdad5 | |
parent | 96cd17dfd1e4dc51a1172f7cb0b9b718c6a05c48 (diff) |
pq: Disable rename tracking
to produce diff compatible patches
-rw-r--r-- | gbp/scripts/common/pq.py | 4 | ||||
-rw-r--r-- | tests/component/deb/test_pq.py | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py index 0225a97e..61ea42c5 100644 --- a/gbp/scripts/common/pq.py +++ b/gbp/scripts/common/pq.py @@ -227,7 +227,7 @@ def format_patch(outdir, repo, commit_info, series, numbered=True, patch = None if paths: diff = repo.diff('%s^!' % commit_info['id'], paths=paths, stat=80, - summary=True, text=True, abbrev=7) + summary=True, text=True, abbrev=7, renames=False) patch = write_patch_file(filepath, commit_info, diff) if patch: series.append(patch) @@ -252,7 +252,7 @@ def format_diff(outdir, filename, repo, start, end, path_exclude_regex=None): paths = patch_path_filter(file_status, path_exclude_regex) if paths: diff = repo.diff(start, end, paths=paths, stat=80, summary=True, - text=True, abbrev=7) + text=True, abbrev=7, renames=False) return write_patch_file(filename, info, diff) return None diff --git a/tests/component/deb/test_pq.py b/tests/component/deb/test_pq.py index 2eebfde8..9c7f0788 100644 --- a/tests/component/deb/test_pq.py +++ b/tests/component/deb/test_pq.py @@ -31,7 +31,7 @@ class TestPq(ComponentTestBase): def _test_pq(self, repo, action, opts=[]): args = ['arg0', action] + opts - os.chdir(repo.path) + os.chdir(os.path.abspath(repo.path)) ret = pq(args) ok_(ret == 0, "Running gbp pq %s failed" % action) @@ -45,3 +45,19 @@ class TestPq(ComponentTestBase): eq_(repo.has_branch('patch-queue/master'), True) self._test_pq(repo, 'drop') eq_(repo.has_branch('patch-queue/master'), False) + + @RepoFixtures.quilt30() + def test_rename(self, repo): + patch = os.path.join(repo.path, 'debian/patches/0001-Rename.patch') + + repo.set_config('diff.renames', 'true') + self._test_pq(repo, 'import') + repo.rename_file('configure.ac', 'renamed') + repo.commit_all("Rename") + self._test_pq(repo, 'export') + self.assertTrue( + os.path.exists(patch)) + # Check the file was removed and added, not renamed + with open(patch) as f: + self.assertTrue('rename from' not in f.read()) + self.assertTrue('rename to' not in f.read()) |