[PATCH V3] histedit: add a config allowing changing histedit rule line length limit
Augie Fackler
raf at durin42.com
Fri Feb 27 14:44:57 CST 2015
On Thu, Feb 26, 2015 at 06:02:30PM -0800, Mateusz Kwapich wrote:
> # HG changeset patch
> # User Mateusz Kwapich <mitrandir at fb.com>
> # Date 1421880324 28800
> # Wed Jan 21 14:45:24 2015 -0800
> # Node ID f7f14d07b00b0e1ae7821d0379d1cc79967123c8
> # Parent ff5caa8dfd993680d9602ca6ebb14da9de10d5f4
> histedit: add a config allowing changing histedit rule line length limit
Please rebase this against crew and send a v4, or wait for mpm to push
and then rebase and send a v4. I'm getting a lot of merge conflicts I
don't have time to sort through right now.
>
> 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.
>
> 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:
> @@ -638,7 +645,7 @@ def _histedit(ui, repo, state, *freeargs
>
> ctxs = [repo[r] for r in revs]
> if not rules:
> - rules = '\n'.join([makedesc(c) for c in ctxs])
> + rules = '\n'.join([makedesc(ui, c) for c in ctxs])
> rules += '\n\n'
> rules += editcomment % (node.short(root), node.short(topmost))
> rules = ui.edit(rules, ui.username())
> @@ -805,7 +812,7 @@ def between(repo, old, new, keep):
> raise util.Abort(_('cannot edit immutable changeset: %s') % root)
> return [c.node() for c in ctxs]
>
> -def makedesc(c):
> +def makedesc(ui, c):
> """build a initial action line for a ctx `c`
>
> line are in the form:
> @@ -817,7 +824,9 @@ def makedesc(c):
> summary = c.description().splitlines()[0]
> line = 'pick %s %d %s' % (c, c.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 verifyrules(rules, repo, ctxs):
> """Verify that there exists exactly one edit rule per given changeset.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list