[PATCH evolve-ext] inhbit: don't crash on commit with no changes
Laurent Charignon
lcharignon at fb.com
Fri May 22 00:44:41 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1432144712 25200
# Wed May 20 10:58:32 2015 -0700
# Node ID f2dacc9545308e1805861ae39820efeea79b6e11
# Parent bc9f871734475292c48dfe54e3040601b32ae4c8
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 --git a/hgext/inhibit.py b/hgext/inhibit.py
--- a/hgext/inhibit.py
+++ b/hgext/inhibit.py
@@ -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 --git a/tests/test-inhibit.t b/tests/test-inhibit.t
--- a/tests/test-inhibit.t
+++ b/tests/test-inhibit.t
@@ -594,15 +594,22 @@
|
o 0:54ccbc537fc2 add cA
+ $ cat >> $HGRCPATH <<EOF
+ > [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 <<EOF
> [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]
-
+
More information about the Mercurial-devel
mailing list