Mercurial > hg > mercurial-crew-with-dirclash
diff mercurial/localrepo.py @ 1721:801756d0ca84
add pretxncommit hook.
hook allows check of changeset after create, but before transaction
is committed. hook failure rolls transaction back.
makes place for local policies like commit message must contain bug id
or reviewer signoff.
change also adds parent changeset ids to commit hook environment,
because is cheap and useful.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 14 Feb 2006 17:13:18 -0800 |
parents | 98072468ffde |
children | 56fb048b102c 0f1d2c75db5e |
line wrap: on
line diff
--- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -376,7 +376,11 @@ class localrepository(object): self.ui.status(_("nothing changed\n")) return None - self.hook("precommit", throw=True) + xp1 = hex(p1) + if p2 == nullid: xp2 = '' + else: xp2 = hex(p2) + + self.hook("precommit", throw=True, p1=xp1, p2=xp2) if not wlock: wlock = self.wlock() @@ -462,13 +466,14 @@ class localrepository(object): user = user or self.ui.username() n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date) + self.hook('pretxncommit', throw=True, node=hex(n), p1=xp1, p2=xp2) tr.close() self.dirstate.setparents(n) self.dirstate.update(new, "n") self.dirstate.forget(remove) - self.hook("commit", node=hex(n)) + self.hook("commit", node=hex(n), p1=xp1, p2=xp2) return n def walk(self, node=None, files=[], match=util.always):