1808
1808
These are all empty initially, because by default nothing should get
1811
Hooks.__init__(self)
1812
self.create_hook(HookPoint('set_rh',
1811
Hooks.__init__(self, "bzrlib.branch", "Branch.hooks")
1812
self.add_hook('set_rh',
1813
1813
"Invoked whenever the revision history has been set via "
1814
1814
"set_revision_history. The api signature is (branch, "
1815
1815
"revision_history), and the branch will be write-locked. "
1816
1816
"The set_rh hook can be expensive for bzr to trigger, a better "
1817
"hook to use is Branch.post_change_branch_tip.", (0, 15), None))
1818
self.create_hook(HookPoint('open',
1817
"hook to use is Branch.post_change_branch_tip.", (0, 15))
1818
self.add_hook('open',
1819
1819
"Called with the Branch object that has been opened after a "
1820
"branch is opened.", (1, 8), None))
1821
self.create_hook(HookPoint('post_push',
1820
"branch is opened.", (1, 8))
1821
self.add_hook('post_push',
1822
1822
"Called after a push operation completes. post_push is called "
1823
1823
"with a bzrlib.branch.BranchPushResult object and only runs in the "
1824
"bzr client.", (0, 15), None))
1825
self.create_hook(HookPoint('post_pull',
1824
"bzr client.", (0, 15))
1825
self.add_hook('post_pull',
1826
1826
"Called after a pull operation completes. post_pull is called "
1827
1827
"with a bzrlib.branch.PullResult object and only runs in the "
1828
"bzr client.", (0, 15), None))
1829
self.create_hook(HookPoint('pre_commit',
1828
"bzr client.", (0, 15))
1829
self.add_hook('pre_commit',
1830
1830
"Called after a commit is calculated but before it is "
1831
1831
"completed. pre_commit is called with (local, master, old_revno, "
1832
1832
"old_revid, future_revno, future_revid, tree_delta, future_tree"
1835
1835
"basis revision. hooks MUST NOT modify this delta. "
1836
1836
" future_tree is an in-memory tree obtained from "
1837
1837
"CommitBuilder.revision_tree() and hooks MUST NOT modify this "
1838
"tree.", (0,91), None))
1839
self.create_hook(HookPoint('post_commit',
1839
self.add_hook('post_commit',
1840
1840
"Called in the bzr client after a commit has completed. "
1841
1841
"post_commit is called with (local, master, old_revno, old_revid, "
1842
1842
"new_revno, new_revid). old_revid is NULL_REVISION for the first "
1843
"commit to a branch.", (0, 15), None))
1844
self.create_hook(HookPoint('post_uncommit',
1843
"commit to a branch.", (0, 15))
1844
self.add_hook('post_uncommit',
1845
1845
"Called in the bzr client after an uncommit completes. "
1846
1846
"post_uncommit is called with (local, master, old_revno, "
1847
1847
"old_revid, new_revno, new_revid) where local is the local branch "
1848
1848
"or None, master is the target branch, and an empty branch "
1849
"receives new_revno of 0, new_revid of None.", (0, 15), None))
1850
self.create_hook(HookPoint('pre_change_branch_tip',
1849
"receives new_revno of 0, new_revid of None.", (0, 15))
1850
self.add_hook('pre_change_branch_tip',
1851
1851
"Called in bzr client and server before a change to the tip of a "
1852
1852
"branch is made. pre_change_branch_tip is called with a "
1853
1853
"bzrlib.branch.ChangeBranchTipParams. Note that push, pull, "
1854
"commit, uncommit will all trigger this hook.", (1, 6), None))
1855
self.create_hook(HookPoint('post_change_branch_tip',
1854
"commit, uncommit will all trigger this hook.", (1, 6))
1855
self.add_hook('post_change_branch_tip',
1856
1856
"Called in bzr client and server after a change to the tip of a "
1857
1857
"branch is made. post_change_branch_tip is called with a "
1858
1858
"bzrlib.branch.ChangeBranchTipParams. Note that push, pull, "
1859
"commit, uncommit will all trigger this hook.", (1, 4), None))
1860
self.create_hook(HookPoint('transform_fallback_location',
1859
"commit, uncommit will all trigger this hook.", (1, 4))
1860
self.add_hook('transform_fallback_location',
1861
1861
"Called when a stacked branch is activating its fallback "
1862
1862
"locations. transform_fallback_location is called with (branch, "
1863
1863
"url), and should return a new url. Returning the same url "
1868
1868
"fallback locations have not been activated. When there are "
1869
1869
"multiple hooks installed for transform_fallback_location, "
1870
1870
"all are called with the url returned from the previous hook."
1871
"The order is however undefined.", (1, 9), None))
1872
self.create_hook(HookPoint('automatic_tag_name',
1871
"The order is however undefined.", (1, 9))
1872
self.add_hook('automatic_tag_name',
1873
1873
"Called to determine an automatic tag name for a revision. "
1874
1874
"automatic_tag_name is called with (branch, revision_id) and "
1875
1875
"should return a tag name or None if no tag name could be "
1876
1876
"determined. The first non-None tag name returned will be used.",
1878
self.create_hook(HookPoint('post_branch_init',
1878
self.add_hook('post_branch_init',
1879
1879
"Called after new branch initialization completes. "
1880
1880
"post_branch_init is called with a "
1881
1881
"bzrlib.branch.BranchInitHookParams. "
1882
1882
"Note that init, branch and checkout (both heavyweight and "
1883
"lightweight) will all trigger this hook.", (2, 2), None))
1884
self.create_hook(HookPoint('post_switch',
1883
"lightweight) will all trigger this hook.", (2, 2))
1884
self.add_hook('post_switch',
1885
1885
"Called after a checkout switches branch. "
1886
1886
"post_switch is called with a "
1887
"bzrlib.branch.SwitchHookParams.", (2, 2), None))
1887
"bzrlib.branch.SwitchHookParams.", (2, 2))