Mercurial > evolve
comparison hgext/inhibit.py @ 1346:9a1415f8b21b
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.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Wed, 20 May 2015 10:58:32 -0700 |
parents | 0e2eb196923a |
children | 73e5b5280c1c |
comparison
equal
deleted
inserted
replaced
1345:37c505975e28 | 1346:9a1415f8b21b |
---|---|
41 obsinhibit.add(raw[i:i+20]) | 41 obsinhibit.add(raw[i:i+20]) |
42 return obsinhibit | 42 return obsinhibit |
43 | 43 |
44 def commit(self, *args, **kwargs): | 44 def commit(self, *args, **kwargs): |
45 newnode = super(obsinhibitedrepo, self).commit(*args, **kwargs) | 45 newnode = super(obsinhibitedrepo, self).commit(*args, **kwargs) |
46 _inhibitmarkers(repo, [newnode]) | 46 if newnode is not None: |
47 _inhibitmarkers(repo, [newnode]) | |
47 return newnode | 48 return newnode |
48 | 49 |
49 repo.__class__ = obsinhibitedrepo | 50 repo.__class__ = obsinhibitedrepo |
50 # Wrapping this to inhibit obsolete revs resulting from a transaction | 51 # Wrapping this to inhibit obsolete revs resulting from a transaction |
51 extensions.wrapfunction(localrepo.localrepository, | 52 extensions.wrapfunction(localrepo.localrepository, |