Show More
@@ -219,10 +219,20 b' hooks::' | |||||
219 | commit to proceed. Non-zero status will cause the transaction to |
|
219 | commit to proceed. Non-zero status will cause the transaction to | |
220 | be rolled back. ID of changeset is in $HG_NODE. Parent changeset |
|
220 | be rolled back. ID of changeset is in $HG_NODE. Parent changeset | |
221 | IDs are in $HG_PARENT1 and $HG_PARENT2. |
|
221 | IDs are in $HG_PARENT1 and $HG_PARENT2. | |
|
222 | preupdate;; | |||
|
223 | Run before updating the working directory. Exit status 0 allows | |||
|
224 | the update to proceed. Non-zero status will prevent the update. | |||
|
225 | Changeset ID of first new parent is in $HG_PARENT1. If merge, ID | |||
|
226 | of second new parent is in $HG_PARENT2. | |||
222 | tag;; |
|
227 | tag;; | |
223 | Run after a tag is created. ID of tagged changeset is in |
|
228 | Run after a tag is created. ID of tagged changeset is in | |
224 | $HG_NODE. Name of tag is in $HG_TAG. Tag is local if |
|
229 | $HG_NODE. Name of tag is in $HG_TAG. Tag is local if | |
225 | $HG_LOCAL=1, in repo if $HG_LOCAL=0. |
|
230 | $HG_LOCAL=1, in repo if $HG_LOCAL=0. | |
|
231 | update;; | |||
|
232 | Run after updating the working directory. Changeset ID of first | |||
|
233 | new parent is in $HG_PARENT1. If merge, ID of second new parent | |||
|
234 | is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update | |||
|
235 | failed (e.g. because conflicts not resolved), $HG_ERROR=1. | |||
226 |
|
236 | |||
227 | In earlier releases, the names of hook environment variables did not |
|
237 | In earlier releases, the names of hook environment variables did not | |
228 | have a "HG_" prefix. These unprefixed names are still provided in |
|
238 | have a "HG_" prefix. These unprefixed names are still provided in |
@@ -1592,6 +1592,7 b' class localrepository(object):' | |||||
1592 | if allow and not forcemerge: |
|
1592 | if allow and not forcemerge: | |
1593 | if modified or added or removed: |
|
1593 | if modified or added or removed: | |
1594 | raise util.Abort(_("outstanding uncommitted changes")) |
|
1594 | raise util.Abort(_("outstanding uncommitted changes")) | |
|
1595 | ||||
1595 | if not forcemerge and not force: |
|
1596 | if not forcemerge and not force: | |
1596 | for f in unknown: |
|
1597 | for f in unknown: | |
1597 | if f in m2: |
|
1598 | if f in m2: | |
@@ -1765,6 +1766,13 b' class localrepository(object):' | |||||
1765 | return 1 |
|
1766 | return 1 | |
1766 | branch_merge = True |
|
1767 | branch_merge = True | |
1767 |
|
1768 | |||
|
1769 | xp1 = hex(p1) | |||
|
1770 | xp2 = hex(p2) | |||
|
1771 | if p2 == nullid: xxp2 = '' | |||
|
1772 | else: xxp2 = xp2 | |||
|
1773 | ||||
|
1774 | self.hook('preupdate', throw=True, parent1=xp1, parent2=xxp2) | |||
|
1775 | ||||
1768 | # get the files we don't need to change |
|
1776 | # get the files we don't need to change | |
1769 | files = get.keys() |
|
1777 | files = get.keys() | |
1770 | files.sort() |
|
1778 | files.sort() | |
@@ -1785,8 +1793,6 b' class localrepository(object):' | |||||
1785 | failedmerge = [] |
|
1793 | failedmerge = [] | |
1786 | files = merge.keys() |
|
1794 | files = merge.keys() | |
1787 | files.sort() |
|
1795 | files.sort() | |
1788 | xp1 = hex(p1) |
|
|||
1789 | xp2 = hex(p2) |
|
|||
1790 | for f in files: |
|
1796 | for f in files: | |
1791 | self.ui.status(_("merging %s\n") % f) |
|
1797 | self.ui.status(_("merging %s\n") % f) | |
1792 | my, other, flag = merge[f] |
|
1798 | my, other, flag = merge[f] | |
@@ -1850,6 +1856,7 b' class localrepository(object):' | |||||
1850 | self.ui.status(_("There are unresolved merges with" |
|
1856 | self.ui.status(_("There are unresolved merges with" | |
1851 | " locally modified files.\n")) |
|
1857 | " locally modified files.\n")) | |
1852 |
|
1858 | |||
|
1859 | self.hook('update', parent1=xp1, parent2=xxp2, error=int(err)) | |||
1853 | return err |
|
1860 | return err | |
1854 |
|
1861 | |||
1855 | def merge3(self, fn, my, other, p1, p2): |
|
1862 | def merge3(self, fn, my, other, p1, p2): |
@@ -61,6 +61,14 b" echo 'precommit.forbid = echo precommit." | |||||
61 | hg commit -m 'fail' -d '4 0' |
|
61 | hg commit -m 'fail' -d '4 0' | |
62 | hg -q tip |
|
62 | hg -q tip | |
63 |
|
63 | |||
|
64 | # preupdate hook can prevent update | |||
|
65 | echo 'preupdate = echo preupdate hook: p1=$HG_PARENT1 p2=$HG_PARENT2' >> .hg/hgrc | |||
|
66 | hg update 1 | |||
|
67 | ||||
|
68 | # update hook | |||
|
69 | echo 'update = echo update hook: p1=$HG_PARENT1 p2=$HG_PARENT2 err=$HG_ERROR' >> .hg/hgrc | |||
|
70 | hg update | |||
|
71 | ||||
64 | # prechangegroup hook can prevent incoming changes |
|
72 | # prechangegroup hook can prevent incoming changes | |
65 | cd ../b |
|
73 | cd ../b | |
66 | hg -q tip |
|
74 | hg -q tip |
@@ -62,6 +62,11 b' precommit hook: p1=4f92e785b90ae8995dfe1' | |||||
62 | precommit.forbid hook |
|
62 | precommit.forbid hook | |
63 | abort: precommit.forbid hook exited with status 1 |
|
63 | abort: precommit.forbid hook exited with status 1 | |
64 | 4:4f92e785b90a |
|
64 | 4:4f92e785b90a | |
|
65 | preupdate hook: p1=b702efe9688826e3a91283852b328b84dbf37bc2 p2= | |||
|
66 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
67 | preupdate hook: p1=4f92e785b90ae8995dfe156e39dd4fbc3b346a24 p2= | |||
|
68 | update hook: p1=4f92e785b90ae8995dfe156e39dd4fbc3b346a24 p2= err=0 | |||
|
69 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
65 | 3:4c52fb2e4022 |
|
70 | 3:4c52fb2e4022 | |
66 | prechangegroup.forbid hook |
|
71 | prechangegroup.forbid hook | |
67 | pulling from ../a |
|
72 | pulling from ../a |
General Comments 0
You need to be logged in to leave comments.
Login now