[MERGE] use terminal_width() for pending-merge display
Adeodato Simó
dato at net.com.org.es
Thu Jul 13 01:45:27 BST 2006
Hi. From the NEWS file:
| * On Unix, detect terminal width using an ioctl not just $COLUMNS.
| Use terminal width for single-line logs from ``bzr log --line`` and
| pending-merge display. (Robert Widhopf-Fenk, Gustavo Niemeyer)
However, the fix merged in rev. 1707 only changed `bzr log --line`,
leaving status.py untouched.
The attached small patch fixes the code to match the NEWS entry.
--
Adeodato Simó dato at net.com.org.es
Debian Developer adeodato at debian.org
— As the ship lay in Boston Harbor, a party the colonists dressed as red
Indians boarded the vessel, behaved very rudely, and threw all the tea
overboard, making the tea unsuitable for drinking. Even for Americans.
-- George W. Banks in “Mary Poppins”
-------------- next part --------------
# Bazaar revision bundle v0.8
#
# message:
# Really use terminal_width() for pending-merge display. r1707 mentioned
# this in NEWS, but did not include that part of the fix.
#
# committer: Adeodato Simó <dato at net.com.org.es>
# date: Thu 2006-07-13 02:25:34.280904055 +0200
=== modified file bzrlib/status.py
--- bzrlib/status.py
+++ bzrlib/status.py
@@ -165,8 +165,10 @@
for merge in new.pending_merges():
ignore.add(merge)
try:
+ from bzrlib.osutils import terminal_width
+ width = terminal_width()
m_revision = branch.repository.get_revision(merge)
- print >> to_file, ' ', line_log(m_revision, 77)
+ print >> to_file, ' ', line_log(m_revision, width - 3)
inner_merges = branch.repository.get_ancestry(merge)
assert inner_merges[0] == None
inner_merges.pop(0)
@@ -175,7 +177,7 @@
if mmerge in ignore:
continue
mm_revision = branch.repository.get_revision(mmerge)
- print >> to_file, ' ', line_log(mm_revision, 75)
+ print >> to_file, ' ', line_log(mm_revision, width - 5)
ignore.add(mmerge)
except errors.NoSuchRevision:
print >> to_file, ' ', merge
# revision id: dato at net.com.org.es-20060713002534-0f6001589ff30c28
# sha1: 530e0ab3b2cc967429260e02245dcc3fa27bef4f
# inventory sha1: d21571a181a4e032c5f3c631575744d5261b5058
# parent ids:
# pqm at pqm.ubuntu.com-20060712215300-126aea223e34b65c
# base id: pqm at pqm.ubuntu.com-20060712215300-126aea223e34b65c
# properties:
# branch-nick: bzr.dev.columns
More information about the bazaar
mailing list