##// END OF EJS Templates
add pretxncommit hook....
Vadim Gelfer -
r1721:801756d0 default
parent child Browse files
Show More
@@ -151,19 +151,27 b' hooks::'
151 commit;;
151 commit;;
152 Run after a changeset has been created in the local repository.
152 Run after a changeset has been created in the local repository.
153 Passed the ID of the newly created changeset in environment
153 Passed the ID of the newly created changeset in environment
154 variable $NODE.
154 variable $NODE. Parent changeset IDs in $P1 and $P2.
155 incoming;;
155 incoming;;
156 Run after a changeset has been pulled, pushed, or unbundled into
156 Run after a changeset has been pulled, pushed, or unbundled into
157 the local repository. Passed the ID of the newly arrived
157 the local repository. Passed the ID of the newly arrived
158 changeset in environment variable $NODE.
158 changeset in environment variable $NODE.
159 precommit;;
159 precommit;;
160 Run before starting a commit. Exit status 0 allows the commit to
160 Run before starting a local commit. Exit status 0 allows the
161 proceed. Non-zero status will cause the commit to fail.
161 commit to proceed. Non-zero status will cause the commit to
162 fail. Parent changeset IDs in $P1 and $P2.
162 pretag;;
163 pretag;;
163 Run before creating a tag. Exit status 0 allows the tag to be
164 Run before creating a tag. Exit status 0 allows the tag to be
164 created. Non-zero status will cause the tag to fail. ID of
165 created. Non-zero status will cause the tag to fail. ID of
165 changeset to tag in $NODE. Name of tag in $TAG. Tag is local if
166 changeset to tag in $NODE. Name of tag in $TAG. Tag is local if
166 $LOCAL=1, in repo if $LOCAL=0.
167 $LOCAL=1, in repo if $LOCAL=0.
168 pretxncommit;;
169 Run after a changeset has been created but the transaction not yet
170 committed. Changeset is visible to hook program. This lets you
171 validate commit message and changes. Exit status 0 allows the
172 commit to proceed. Non-zero status will cause the transaction to
173 be rolled back. ID of changeset in $NODE. Parent changeset IDs
174 in $P1 and $P2.
167 tag;;
175 tag;;
168 Run after a tag is created. ID of tagged changeset in $NODE.
176 Run after a tag is created. ID of tagged changeset in $NODE.
169 Name of tag in $TAG. Tag is local if $LOCAL=1, in repo if
177 Name of tag in $TAG. Tag is local if $LOCAL=1, in repo if
@@ -376,7 +376,11 b' class localrepository(object):'
376 self.ui.status(_("nothing changed\n"))
376 self.ui.status(_("nothing changed\n"))
377 return None
377 return None
378
378
379 self.hook("precommit", throw=True)
379 xp1 = hex(p1)
380 if p2 == nullid: xp2 = ''
381 else: xp2 = hex(p2)
382
383 self.hook("precommit", throw=True, p1=xp1, p2=xp2)
380
384
381 if not wlock:
385 if not wlock:
382 wlock = self.wlock()
386 wlock = self.wlock()
@@ -462,13 +466,14 b' class localrepository(object):'
462
466
463 user = user or self.ui.username()
467 user = user or self.ui.username()
464 n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date)
468 n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date)
469 self.hook('pretxncommit', throw=True, node=hex(n), p1=xp1, p2=xp2)
465 tr.close()
470 tr.close()
466
471
467 self.dirstate.setparents(n)
472 self.dirstate.setparents(n)
468 self.dirstate.update(new, "n")
473 self.dirstate.update(new, "n")
469 self.dirstate.forget(remove)
474 self.dirstate.forget(remove)
470
475
471 self.hook("commit", node=hex(n))
476 self.hook("commit", node=hex(n), p1=xp1, p2=xp2)
472 return n
477 return n
473
478
474 def walk(self, node=None, files=[], match=util.always):
479 def walk(self, node=None, files=[], match=util.always):
General Comments 0
You need to be logged in to leave comments. Login now