# HG changeset patch # User Laurent Charignon # Date 1432144712 25200 # Node ID 9a1415f8b21b2936aecd030433e6dbc869ebcaaf # Parent 37c505975e28216af0ee64e551120c180e73878f inhbit: don't crash on commit with no changes Before this patch inhibit would crash when running hg amend with no changes. This patch fixes this case and adds a test to prevent regression. diff -r 37c505975e28 -r 9a1415f8b21b hgext/inhibit.py --- a/hgext/inhibit.py Wed May 20 13:32:32 2015 -0700 +++ b/hgext/inhibit.py Wed May 20 10:58:32 2015 -0700 @@ -43,7 +43,8 @@ def commit(self, *args, **kwargs): newnode = super(obsinhibitedrepo, self).commit(*args, **kwargs) - _inhibitmarkers(repo, [newnode]) + if newnode is not None: + _inhibitmarkers(repo, [newnode]) return newnode repo.__class__ = obsinhibitedrepo diff -r 37c505975e28 -r 9a1415f8b21b tests/test-inhibit.t --- a/tests/test-inhibit.t Wed May 20 13:32:32 2015 -0700 +++ b/tests/test-inhibit.t Wed May 20 10:58:32 2015 -0700 @@ -676,15 +676,22 @@ | o 0:54ccbc537fc2 add cA + $ cat >> $HGRCPATH < [extensions] + > EOF + $ echo "inhibit=$(echo $(dirname $TESTDIR))/hgext/inhibit.py" >> $HGRCPATH + +Empty commit + $ hg amend + nothing changed + [1] Inhibit should not work without directaccess $ cat >> $HGRCPATH < [extensions] > directaccess=! > EOF - $ echo "inhibit=$(echo $(dirname $TESTDIR))/hgext/inhibit.py" >> $HGRCPATH - $ hg up 15 abort: Cannot use inhibit without the direct access extension [255] - +