Patchwork [V3_REBASED] histedit: add a config allowing changing histedit rule line length limit

login
register
mail settings
Submitter Mateusz Kwapich
Date March 4, 2015, 6:50 p.m.
Message ID <a8b8a0c237a20b825242.1425495043@dev1429.prn1.facebook.com>
Download mbox | patch
Permalink /patch/7904/
State Accepted
Commit 4047982904f8b14255c2bdbf1b37e3c25e960777
Headers show

Comments

Mateusz Kwapich - March 4, 2015, 6:50 p.m.
# HG changeset patch
# User Mateusz Kwapich <mitrandir@fb.com>
# Date 1421880324 28800
#      Wed Jan 21 14:45:24 2015 -0800
# Node ID a8b8a0c237a20b8252427319d2d5dcc0d936f3ff
# Parent  390410a6545d9088dc84392009f51500e3935a1c
histedit: add a config allowing changing histedit rule line length limit

Since many users are using terminals wider than 80 chars there should be an
option to have longer lines in histedit editor.

Even if the summary line is shorter than 80 chars after adding action line
prefixes (like "pick 7c2fd3b9020c") it doesn't fit there anymore. Setting
it to for example 110 would be a  nice option to have.
Matt Mackall - March 4, 2015, 7:50 p.m.
On Wed, 2015-03-04 at 10:50 -0800, Mateusz Kwapich wrote:
> # HG changeset patch
> # User Mateusz Kwapich <mitrandir@fb.com>
> # Date 1421880324 28800
> #      Wed Jan 21 14:45:24 2015 -0800
> # Node ID a8b8a0c237a20b8252427319d2d5dcc0d936f3ff
> # Parent  390410a6545d9088dc84392009f51500e3935a1c
> histedit: add a config allowing changing histedit rule line length limit

Queued for default, thanks.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -142,6 +142,13 @@  If you run ``hg histedit --outgoing`` on
 as running ``hg histedit 836302820282``. If you need plan to push to a
 repository that Mercurial does not detect to be related to the source
 repo, you can add a ``--force`` option.
+
+Histedit rule lines are truncated to 80 characters by default. You
+can customise this behaviour by setting a different length in your
+configuration file:
+
+[histedit]
+linelen = 120      # truncate rule lines at 120 characters
 """
 
 try:
@@ -843,7 +850,9 @@  def makedesc(repo, action, rev):
         summary = ctx.description().splitlines()[0]
     line = '%s %s %d %s' % (action, ctx, ctx.rev(), summary)
     # trim to 80 columns so it's not stupidly wide in my editor
-    return util.ellipsis(line, 80)
+    maxlen = ui.configint('histedit', 'linelen', default=80)
+    maxlen = max(maxlen, 22) # avoid truncating hash
+    return util.ellipsis(line, maxlen)
 
 def ruleeditor(repo, ui, rules, editcomment=""):
     """open an editor to edit rules