summaryrefslogtreecommitdiffstats
path: root/pym/repoman
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-21 01:11:32 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-21 01:11:32 -0700
commit0c63881bf206f8b5f707b1ca4ea2b171d740913d (patch)
treefe36fbb36c0dc927d2fbcb746f65c1a199c966a1 /pym/repoman
parent9f6fe53436112b7cd764b0c2c24ee2e59fa8ad8f (diff)
downloadportage-0c63881bf206f8b5f707b1ca4ea2b171d740913d.tar.gz
portage-0c63881bf206f8b5f707b1ca4ea2b171d740913d.tar.bz2
portage-0c63881bf206f8b5f707b1ca4ea2b171d740913d.zip
UpdateChangeLog: tweak clold_lines logic
There are two cases here that have to be mutually exclusive.
Diffstat (limited to 'pym/repoman')
-rw-r--r--pym/repoman/utilities.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index fa5834618..a79ea2cd5 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -771,25 +771,28 @@ def UpdateChangeLog(pkgdir, user, msg, skel_path, category, package,
# append stuff from old ChangeLog
if clold_file is not None:
- # clold_lines may contain a saved non-header line
- # that we want to write first.
- # Also, append this line to clnew_lines so that the
- # unified_diff call doesn't show it as removed.
- for line in clold_lines:
- f.write(line)
- clnew_lines.append(line)
+
+ if clold_lines:
+ # clold_lines may contain a saved non-header line
+ # that we want to write first.
+ # Also, append this line to clnew_lines so that the
+ # unified_diff call doesn't show it as removed.
+ for line in clold_lines:
+ f.write(line)
+ clnew_lines.append(line)
+
+ else:
+ # ensure that there is no more than one blank
+ # line after our new entry
+ for line in clold_file:
+ if line.strip():
+ f.write(line)
+ break
# Now prepend old_header_lines to clold_lines, for use
# in the unified_diff call below.
clold_lines = old_header_lines + clold_lines
- # ensure that there is no more than one blank
- # line after our new entry
- for line in clold_file:
- if line.strip():
- f.write(line)
- break
-
for line in clold_file:
f.write(line)
clold_file.close()