Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/hg/README.md

Issue 29339623: Issue 3681 - Add suport for "Fixes XXXX - ..." commit messages (Closed)
Left Patch Set: Split into two hooks to handle the master bookmark, move documentation to README, add tests Created April 24, 2016, 9:33 p.m.
Right Patch Set: Fix Strunk+White violations Created May 18, 2016, 8:29 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « .sitescripts.example ('k') | sitescripts/hg/bin/update_issues.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Mercurial hooks 1 # Mercurial hooks
kzar 2016/04/29 14:05:43 Please could you add a brief introduction section
Vasily Kuznetsov 2016/05/02 16:54:03 If we're adding an introduction about sitescripts.
kzar 2016/05/03 06:47:35 You're right, this looks fine for now and at some
2 2
3 There are two hooks contained in `sitescripts/hg/bin/update_issues.py`: 3 `sitescripts/hg` contains Mercurial hooks for integration with other components
4 `changegroup_hook` and `pushkey_hook`. The hooks will recognise issue 4 of our infrastructure.
5 references in commit messages and update referenced issues in Adblock Plus 5
6 issue tracker. 6 ## IRC integration
7
8 `irchook.py` contains a commit hook that posts the information about new pushed
9 commits to an IRC channel.
10
11 ## Trac integration
12
13 `update_issues.py` contains two hooks: `changegroup_hook` and `pushkey_hook`.
14 They will recognise issue references in commit messages and update referenced
15 issues in the Adblock Plus issue tracker.
7 16
8 The format of the commit messages is "ISSUE-REFERENCE - MESSAGE" 17 The format of the commit messages is "ISSUE-REFERENCE - MESSAGE"
9 where ISSUE-REFERENCE is one of "Noissue", "Issue NUMBER" or "Fixes NUMBER". 18 where ISSUE-REFERENCE is one of "Noissue", "Issue NUMBER" or "Fixes NUMBER".
10 Several "Issue" and "Fixes" references separated by commas can be present 19 Several "Issue" and "Fixes" references separated by commas can be present
11 in the same commit message (for example: "Issue 1, Fixes 2 - Two issues"). 20 in the same commit message (for example: "Issue 1, Fixes 2 - Two issues").
12 Such commit will affect all the referenced issues. 21 Such commit will affect all the referenced issues.
13 22
14 * `changegroup_hook` will post a comment with the link to the commit into the 23 * `changegroup_hook` will post a comment with the link to the commit into the
15 issue if the issue is referenced from the commit message. 24 issue if the issue is referenced from the commit message.
16 * `pushkey_hook` will close the issues and assign milestones to them (based 25 * `pushkey_hook` will close the issues and assign milestones to them (based
17 on their module) when `master` bookmark passes over the commits that fix 26 on their module) when the `master` bookmark passes over the commits that fix
18 them. It will not assign a milestone if the issue already has one. 27 them. It will not assign a milestone if the issue already has one.
19 28
20 ## Configuring the repository 29 ### Configuring the repository
21 30
kzar 2016/04/29 14:05:42 Nit: Looks like a typo around "in"?
Vasily Kuznetsov 2016/05/02 16:54:03 Done.
22 `changegroup_hook` in should be installed as `changegroup` or 31 `changegroup_hook` should be installed as `changegroup` or
23 `pretxnchangegroup` hook. `pushkey_hook` should be installed as 32 `pretxnchangegroup` hook. `pushkey_hook` should be installed as
24 `pushkey` or `prepushkey` hook. For example (in `.hg/hgrc`): 33 `pushkey` or `prepushkey` hook. For example (in `.hg/hgrc`):
25 34
26 [hooks] 35 [hooks]
27 pretxnchangegroup = python:.../update_issues.py:changegroup_hook 36 pretxnchangegroup = python:.../update_issues.py:changegroup_hook
28 pushkey = python:.../update_issues.py:pushkey_hook 37 pushkey = python:.../update_issues.py:pushkey_hook
29 38
30 ## Configuring the hooks 39 ### Configuring the hooks
31 40
32 The hooks are configured via `sitescripts.ini` in `hg` and 41 The hooks are configured via `sitescripts.ini` in `hg` and
33 `hg_module_milestones` sections. For example: 42 `hg_module_milestones` sections. For example:
34 43
35 [hg] 44 [hg]
36 trac_xmlrpc_url=https://abpbot:abpbot@issues.adblockplus.org/login/xmlrpc 45 trac_xmlrpc_url=https://abpbot:abpbot@issues.adblockplus.org/login/xmlrpc
37 issue_url_template=https://issues.adblockplus.org/ticket/{id} 46 issue_url_template=https://issues.adblockplus.org/ticket/{id}
38 47
39 [hg_module_milestones] 48 [hg_module_milestones]
40 platform=Adblock-Plus(-[\d\.]+)?-for-Chrome-Opera-Safari(-next)? 49 platform=adblock-plus(-[\d\.]+)?-for-chrome-opera-safari(-next)?
41 Adblock-Plus-for-Firefox=Adblock-Plus(-[\d\.]+)?-for-Firefox(-next)? 50 Adblock-Plus-for-Firefox=adblock-plus(-[\d\.]+)?-for-firefox(-next)?
42 51
43 `hg.track_xmlrpc_url` key from is used to determine the address of XMLRPC 52 `hg.track_xmlrpc_url` key from is used to determine the address of XMLRPC
44 interface of Trac and `hg.issue_url_template` as a template for producing links to 53 interface of Trac and `hg.issue_url_template` as a template for producing links
kzar 2016/04/29 14:05:43 Nit: Slightly too long line here and below
Vasily Kuznetsov 2016/05/02 16:54:03 Done.
45 the referenced issues that are displayed in the log. 54 to the referenced issues that are displayed in the log.
46 55
47 The keys of the `hg_module_milestones` section are module names and the values a re 56 The keys of the `hg_module_milestones` section are module names and the values
48 corresponding milestone regular expressions. The first open milestone that 57 are corresponding milestone regular expressions (they are matched
49 matches the regular expression of issue's module will be assigned to the issue 58 case-insensitively). The first open milestone that matches the regular
50 when the `master` bookmark passes a commit that fixes it. 59 expression of the issue's module will be assigned to the issue when the
60 `master` bookmark passes a commit that fixes it.
51 61
52 ## Master bookmark 62 ### Master bookmark
53 63
54 What exactly does it mean when we say _`master` bookmark is passing a commit_. 64 What exactly does it mean when we say _`master` bookmark is passing a commit_?
kzar 2016/04/29 14:05:43 Nit: Maybe this sentence should end in a question
Vasily Kuznetsov 2016/05/02 16:54:02 Done.
55 The idea is that if the `master` bookmark _passed_ a commit we will have 65 The idea is that if the `master` bookmark _passed_ a commit we will have
56 those changes in our working copy when we do `hg checkout master`. 66 those changes in our working copy when we do `hg checkout master`.
57 67
58 Let's first look at a simple case, linear commit history like this: 68 Let's first look at a simple case, linear commit history like this:
59 69
60 one <- two <- three 70 one <- two <- three
61 71
62 Here `one` is a parent commit of `two` and `two` is a parent of `three`. If 72 Here `one` is a parent commit of `two` and `two` is a parent of `three`. If
63 the `master` bookmark was on `one` and then moved to `three`, we say that it 73 the `master` bookmark was on `one` and then moved to `three`, we say that it
64 passed `two` and `three`. This would happen naturally if we clone the 74 passed `two` and `three`. This would happen naturally if we clone the
65 repository that contains `one` with the `master` bookmark pointing to it, 75 repository that contains `one` with the `master` bookmark pointing to it,
66 check out `master`, author two commits and then push them. 76 check out `master`, author two commits and then push them.
67 77
68 A somewhat similar thing happens when we have branches: 78 A somewhat similar thing happens when we have branches:
69 79
70 one <---- two <---- three 80 one <---- two <---- three
71 \ / 81 \ /
72 \-- dos <--/ 82 \-- dos <--/
73 83
74 Here `one` is a parent commit of `two` and `dos` and they are both parents 84 Here `one` is a parent commit of `two` and `dos` and they are both parents
75 of `three`. If the `master` bookmark was on `two` and now is on `three`, 85 of `three`. If the `master` bookmark was on `two` and now is on `three`,
76 we say that it passed `three` and `dos`. What happened here is that by `three` 86 we say that it passed `three` and `dos`. What happened here is that by `three`
77 we've merged a branch containing `dos` into the master branch that was going 87 we've merged a branch containing `dos` into the master branch that was going
78 through `one` and `two`. 88 through `one` and `two`.
LEFTRIGHT

Powered by Google App Engine
This is Rietveld