diff hgext/histedit.py @ 24009:00d331763442

histedit: allow configuring default behavior Adds a configuration setting for allowing users to specify the default behavior of 'hg histedit' without arguments. This saves users from having to manually figure out the bottom commit or a complicated revset. My current revset of choice is "only(.) & draft() - ::merge()" The commits that histedit can work with is usually quite limited, so if this feature ends up working well, we may want to consider making "only(.) & draft() - ::merge()" the default behavior for everyone.
author Durham Goode <durham@fb.com>
date Mon, 02 Feb 2015 16:19:35 -0800
parents 96d130697f07
children 11d72683f3de
line wrap: on
line diff
--- a/hgext/histedit.py	Sun Feb 01 14:05:15 2015 -0500
+++ b/hgext/histedit.py	Mon Feb 02 16:19:35 2015 -0800
@@ -579,6 +579,10 @@
                     _('only one repo argument allowed with --outgoing'))
         else:
             revs.extend(freeargs)
+            if len(revs) == 0:
+                histeditdefault = ui.config('histedit', 'defaultrev')
+                if histeditdefault:
+                    revs.append(histeditdefault)
             if len(revs) != 1:
                 raise util.Abort(
                     _('histedit requires exactly one ancestor revision'))