Merge ~nacc/git-ubuntu:use-dpkg-mergechangelogs into git-ubuntu:master

Proposed by Nish Aravamudan
Status: Merged
Merged at revision: 2fe190cc8163d04da5babbc4fda4fa79ca8093cc
Proposed branch: ~nacc/git-ubuntu:use-dpkg-mergechangelogs
Merge into: git-ubuntu:master
Diff against target: 60 lines (+18/-12)
2 files modified
gitubuntu/git_repository.py (+1/-1)
gitubuntu/lint.py (+17/-11)
Reviewer Review Type Date Requested Status
Robie Basak Approve
Review via email: mp+328127@code.launchpad.net

This proposal supersedes a proposal from 2017-07-19.

To post a comment you must log in.
Revision history for this message
Robie Basak (racb) wrote : Posted in a previous version of this proposal

Comments inline.

review: Needs Fixing
Revision history for this message
Nish Aravamudan (nacc) wrote :

I think I addressed all the review comments.

e537604... by Nish Aravamudan

gitubuntu/git_repository: cat-file produces extra blank lines

Revision history for this message
Nish Aravamudan (nacc) wrote :

Hi Robie, I just pushed one additional commit, which I think resolves the issue we discussed on IRC during the sprint, when `git cat-file` emits an extra newline after the file contents.

Revision history for this message
Robie Basak (racb) wrote :

Looks good!

I'm not keen on the clobbering of the work tree, but I think we need to fix that separately.

> gitubuntu/git_repository: cat-file produces extra blank lines

I think the commit summary should be written in the sense of what is being changed, rather than the problem being fixed. Though the problem being fixed is fine to explain the commit description.

So how about: "GitUbuntuRepository: suppress extra cat-file blank lines"

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/gitubuntu/git_repository.py b/gitubuntu/git_repository.py
index da330ab..ba0480b 100644
--- a/gitubuntu/git_repository.py
+++ b/gitubuntu/git_repository.py
@@ -439,7 +439,7 @@ class GitUbuntuRepository:
439 cat_changelog_cmd = (439 cat_changelog_cmd = (
440 "echo %s | "440 "echo %s | "
441 "git cat-file --batch --follow-symlinks | "441 "git cat-file --batch --follow-symlinks | "
442 "sed -n '1{/^[^ ]* blob/!{p;q1}};2,$p'"442 "sed -n '1{/^[^ ]* blob/!{p;q1}};${/^$/d};2,$p'"
443 % changelog_file443 % changelog_file
444 )444 )
445445
diff --git a/gitubuntu/lint.py b/gitubuntu/lint.py
index d1b2802..ef3652f 100644
--- a/gitubuntu/lint.py
+++ b/gitubuntu/lint.py
@@ -269,25 +269,31 @@ class GitUbuntuLint:
269 self.local_repo.get_commitish(new).id)269 self.local_repo.get_commitish(new).id)
270 )270 )
271 self.local_repo.checkout_commitish(new)271 self.local_repo.checkout_commitish(new)
272 changelog_files = []
272 try:273 try:
273 for cmd in ['git-ubuntu.merge-changelogs', 'git-merge-changelogs']:274 for tree in [merge_base_id, old, new]:
274 try:275 changelog_files.append(
275 run([cmd, merge_base_id, old, new])276 self.local_repo.extract_file_from_treeish(
276 break277 tree,
277 except (CalledProcessError, FileNotFoundError):278 "debian/changelog",
278 continue279 )
279 else:280 )
280 logging.error("Unable to find/execute merge-changelogs")281 run(["dpkg-mergechangelogs"] + [f.name for f in changelog_files] +
281 return None282 ["debian/changelog"]
282283 )
283 self.local_repo.git_run(284 self.local_repo.git_run(
284 ["--work-tree", ".", "add", "-f", "-A"],285 ["--work-tree", ".", "add", "-f", "debian/changelog"],
285 )286 )
286 cp = self.local_repo.git_run(287 cp = self.local_repo.git_run(
287 ["--work-tree", ".", "write-tree"],288 ["--work-tree", ".", "write-tree"],
288 )289 )
289 return decode_binary(cp.stdout).strip()290 return decode_binary(cp.stdout).strip()
291 except (CalledProcessError, FileNotFoundError):
292 logging.error("Unable to find/execute dpkg-mergechangelogs")
293 return None
290 finally:294 finally:
295 for f in changelog_files:
296 f.close()
291 self.local_repo.git_run(["clean", "-f", "-d"])297 self.local_repo.git_run(["clean", "-f", "-d"])
292 self.local_repo.reset_commitish(new)298 self.local_repo.reset_commitish(new)
293 self.local_repo.checkout_commitish(commitish_id)299 self.local_repo.checkout_commitish(commitish_id)

Subscribers

People subscribed via source and target branches