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

Side by Side Diff: eyeo-depup/README.md

Issue 29599579: OffTopic: DependencyUpdater
Patch Set: Created Nov. 27, 2017, 9:40 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Easy dependency updating
2
3 ## Introduction
4
5 This program is meant to ease the process of gathering information /
6 preparing an issue on issues.adblockplus.org, in order to update a given
kzar 2017/11/27 15:03:32 Maybe remove "on issues.adblockplus.org"?
7 dependency.
8
9 You can run this program to get a list of potentially included changes
kzar 2017/11/27 15:03:31 Maybe reword this to "You can run this program to
10 (represented by their commit messages). You can create a unified diff of all
11 potentially included changes or you can create an issue body, which is supposed
12 to be filed on https://issues.adblockplus.org. After filing an issue and hence
13 having a corresponding issue number, you can commit the necessary changes in
14 order to actually perform a dependency update.
15
16 Since there won't be any way to bridge submodules / subrepositories between
kzar 2017/11/27 15:03:30 Maybe add more context here? "In order to provide
17 Git and Mercurial any time soon, we will stay dependent on a manual approach
18 for mirroring these ourselves.
19
20 ## Requirements
21
22 - [Python 2.7](https://www.python.org/download/releases/2.7/)
23 - [Git](https://git-scm.com/)
24 - [Mercurial](https://www.mercurial-scm.org/)
25
26 _(Please note, as soon as https://hg.adblockplus.org/buildtools/file/tip/ensure_ dependencies.py
27 is made Python 3.* compatible, the requirement for Python 2.7.* will be removed. )_
28
29 ## Compatibility
30
31 This program runs with both Python 2.7.* and Python 3.*.
32
33 ## Installation
34
35 Execute setup.py:
36 ```
37 $ python setup.py install
38 ```
39
40 _Please note: setup.py will additionally install
41 [jinja2](http://jinja.pocoo.org/docs/2.9/) on your machine._
42
43 ## Limitations
44
45 Mainly due to humans being involved in reporting issues, there is no guarantee
46 that looking up integration notes will find everything that is needed to be
47 done, in order to update to a new revision.
48
49 ## Running the programm
50
51 Simply call the executable inside a repository which as dependencies.
52 A few examples:
53
54 ### Show a list of changes between the current revision and the remote master fo r adblockpluscore
55
56 ```
57 $ eyeo-depup changes adblockpluscore
58 ```
59
60 Result:
61
62 ```
63 ( dbfc37143497 ) : Noissue - Fix the escaping of '{' and '}' in CSS selectors (b y Hubert Figuière)
64 ( 1bb277740973 ) : Issue 5160 - Alias new class names and properties. (by Hubert Figuière)
65 ( 280efb445cc1 ) : Issue 5147 - Invalidate wrapper on delete (by Hubert Figuière )
66
67 ```
68
69 ### Generate a bare issue body for updating to the local master branch/bookmark (-r master), without mirroring Git if Mercurial is used (or vice versa) to figur e out the corresponding revision (-s)
70
71 ```
72 $ eyeo-depup issue adblockpluscore -r master -s
73 ```
74
75 Result:
76
77 ```
78 === Background ===
79
80 CHANGE ME!
81
82 === Included changes in `adblockpluscore` ===
83 The list of changes imported by this is:
84 [[TicketQuery(id=5728&id=5773&id=5797&id=5735,order=id,desc=1,format=table,col=s ummary|component)]]
85
86 || [https://hg.adblockplus.org/adblockpluscore/rev/dbfc37143497 dbfc37143497] || Noissue - Fix the escaping of '{' and '}' in CSS selectors || Hubert Figuière | |
87 || [https://hg.adblockplus.org/adblockpluscore/rev/b21bddce2678 b21bddce2678] || Noissue - Fixed typo with getLocalizedTexts function || Dave Barker ||
88 || [https://hg.adblockplus.org/adblockpluscore/rev/a1b481e7d728 a1b481e7d728] || Noissue - Updated recommended subscriptions || Wladimir Palant ||
89 || [https://hg.adblockplus.org/adblockpluscore/rev/fb758f96f7bb fb758f96f7bb] || Noissue - rename variable 'ret' to more meaningful 'filter' in lib/filterClasse s.js || Sergei Zabolotskikh ||
90
91
92 === What to change ===
93 Update the `adblockpluscore` dependency to:
94
95 || **mercurial** || **git** ||
96 || dbfc37143497 || NO MIRROR ||
97
98 === Integration Notes ===
99
100 CHANGE ME!
101
102 === Hints for testers ===
103
104 CHANGE ME!
105 ```
106
107 ### Print information on the last 5 commits (-r HEAD~5) and lookup possible "Int egration Notes" for those (-l)
108
109 ```
110 (gitrepo)$ eyeo-depup changes adblockpluscore -r HEAD~5 -l
111 ```
112
113 Result:
114 ```
115 WARNING: you are trying to downgrade the dependency!
116 Integration notes found: https://issues.adblockplus.org/ticket/5735
117 ( 2b57122 ) : Noissue - Fixed typo with getLocalizedTexts function Review: https ://codereview.adblockplus.org/29567746/ (by Dave Barker)
118 ( 662ce93 ) : Noissue - Updated recommended subscriptions (by Wladimir Palant)
119 ( 0591517 ) : Issue 5773 - use ES6 for stylesheets and cssRules. (by Hubert Figu ière)
120 ( 991b43c ) : Issue 5797 - Removed obsolete arguments from ElemHideEmulation con structor (by Sebastian Noack)
121 ( e533ded ) : Issue 5735 - Use JS Map instead of Object for matcher properties f ilterByKeyword and keywordByFilter (by Sergei Zabolotskikh)
122 ```
123
124 ### Generate a unified diff for the changes to buildtools @ remote master
125 ```
126 $ eyeo-depup diff buildtools
127 ```
128
129 Result:
130 ```
131 diff --git a/.gitignore b/.gitignore
132 index 4090c27..5832582 100644
133 --- a/.gitignore
134 +++ b/.gitignore
135 @@ -1,3 +1,6 @@
136 *.pyc
137 *.pyo
138 /.tox
139 +/.cache
140 +.coverage
141
142 ...
143 ...
kzar 2017/11/27 15:03:30 Nit: Duplicate ellipses.
144 ```
145
146 ### Commit all necessary changes (along with file updates done by ensure_depende ncies.py) to perform a dependency update
147 **Note**: You must have already created an issue and know the corresponding
148 issue number for this
149 ```
150 $ eyeo-depup commit buildtools 5698
151 ```
152
153 Result:
154 ```
155 Issue 5698 - Update buildtools to 1c798cc8b402 / 9643c0
156 ```
157
158 ## Help
159
160 Depup comes with an integrated help page for each subcommand. The full pages:
161
162 ### Root
163
164 ```
165 usage: eyeo-depup [-h] [subcommand] ...
166
167 Prepare a dependency update.
168
169 This script executes the automatable work which needs to be done for a
170 dependency update and provides additional information, i.e. a complete
171 diff of imported changes, as well as related integration notes.
172
173 optional arguments:
174 -h, --help show this help message and exit
175
176 Subcommands:
177 [subcommand] Required, the actual command to be executed. Execute run
178 "<subcommand> -h" for more information.
179 diff Create a unified diff of all changes
180 issue Render an issue body
181 changes Generate a list of commits between two revisions
182 commit Update and commit a dependency change
183
184 ```
185
186 ### diff
187
188 ```
189 usage: eyeo-depup diff [-h] [-r NEW_REVISION] [-m LOCAL_MIRROR] [-f FILENAME]
190 [-s] [-l] [-n UNIFIED_LINES]
191 dependency
192
193 Invoke the current repository's VCS to generate a diff, containing all changes
194 made between two revisions.
195
196 optional arguments:
197 -h, --help show this help message and exit
198 -n UNIFIED_LINES, --n-context-lines UNIFIED_LINES
199 Number of unified context lines to be added to the
200 diff. Defaults to 16 (Used only with -d/--diff).
201
202 dependency The dependency to be updated, as specified in the
203 dependencies file.
204 -r NEW_REVISION, --revision NEW_REVISION
205 The revision to update to. Defaults to the remote
206 master bookmark/branch. Must be accessible by the
207 dependency's vcs.
208 -m LOCAL_MIRROR, --mirrored-repository LOCAL_MIRROR
209 Path to the local copy of a mirrored repository. Used
210 to fetch the corresponding hash. If not given, the
211 source parsed from the dependencies file is used.
212 -f FILENAME, --filename FILENAME
213 When specified, write the subcommand's output to the
214 given file, rather than to STDOUT.
215 -s, --skip-mirror Do not use any mirror.
216 -l, --lookup-integration-notes
217 Search https://issues.adblockplus.org for integration
218 notes associated with the included issue IDs. The
219 results are written to STDERR. CAUTION: This is a very
220 network heavy operation.
221
222 ```
223
224 ### changes
225
226 ```
227 usage: eyeo-depup changes [-h] [-r NEW_REVISION] [-m LOCAL_MIRROR]
228 [-f FILENAME] [-s] [-l]
229 dependency
230
231 Generate a list of commit hashes and commit messages between the dependency's
232 current revision and a given new revision.
233
234 optional arguments:
235 -h, --help show this help message and exit
236
237 dependency The dependency to be updated, as specified in the
238 dependencies file.
239 -r NEW_REVISION, --revision NEW_REVISION
240 The revision to update to. Defaults to the remote
241 master bookmark/branch. Must be accessible by the
242 dependency's vcs.
243 -m LOCAL_MIRROR, --mirrored-repository LOCAL_MIRROR
244 Path to the local copy of a mirrored repository. Used
245 to fetch the corresponding hash. If not given, the
246 source parsed from the dependencies file is used.
247 -f FILENAME, --filename FILENAME
248 When specified, write the subcommand's output to the
249 given file, rather than to STDOUT.
250 -s, --skip-mirror Do not use any mirror.
251 -l, --lookup-integration-notes
252 Search https://issues.adblockplus.org for integration
253 notes associated with the included issue IDs. The
254 results are written to STDERR. CAUTION: This is a very
255 network heavy operation.
256
257 ```
258
259 ### issue
260
261 ```
262 usage: eyeo-depup issue [-h] [-r NEW_REVISION] [-m LOCAL_MIRROR] [-f FILENAME]
263 [-s] [-l] [-t TMPL_PATH]
264 dependency
265
266 Render an issue subject and an issue body, according to the given template.
267
268 optional arguments:
269 -h, --help show this help message and exit
270 -t TMPL_PATH, --template TMPL_PATH
271 The template to use. Defaults to the provided
272 default.trac.
273
274 dependency The dependency to be updated, as specified in the
275 dependencies file.
276 -r NEW_REVISION, --revision NEW_REVISION
277 The revision to update to. Defaults to the remote
278 master bookmark/branch. Must be accessible by the
279 dependency's vcs.
280 -m LOCAL_MIRROR, --mirrored-repository LOCAL_MIRROR
281 Path to the local copy of a mirrored repository. Used
282 to fetch the corresponding hash. If not given, the
283 source parsed from the dependencies file is used.
284 -f FILENAME, --filename FILENAME
285 When specified, write the subcommand's output to the
286 given file, rather than to STDOUT.
287 -s, --skip-mirror Do not use any mirror.
288 -l, --lookup-integration-notes
289 Search https://issues.adblockplus.org for integration
290 notes associated with the included issue IDs. The
291 results are written to STDERR. CAUTION: This is a very
292 network heavy operation.
293
294 ```
295
296 ### commit
297
298 ```
299 usage: eyeo-depup commit [-h] [-r NEW_REVISION] [-m LOCAL_MIRROR]
300 dependency issue_number
301
302 Rewrite and commit a dependency file to the new revision. WARNING: This
303 actually changes your repository's history, use with care!
304
305 positional arguments:
306 issue_number The issue number, filed on
307 https://issues.adblockplus.org
308
309 optional arguments:
310 -h, --help show this help message and exit
311
312 dependency The dependency to be updated, as specified in the
313 dependencies file.
314 -r NEW_REVISION, --revision NEW_REVISION
315 The revision to update to. Defaults to the remote
316 master bookmark/branch. Must be accessible by the
317 dependency's vcs.
318 -m LOCAL_MIRROR, --mirrored-repository LOCAL_MIRROR
319 Path to the local copy of a mirrored repository. Used
320 to fetch the corresponding hash. If not given, the
321 source parsed from the dependencies file is used.
322
323 ```
324
325 ## Templating
326
327 You can provide your own template, which can be rendered with all available info rmation. The default template renders as shown in the above example.
328
329 There are at any time these values exposed to the template:
330
331 - `repository` - the repository to update (equals the positional argument of eye o-depup).
332 - `raw_changes` - the unparsed but mirrored list of changes (if existing, the it em at index 0 is the revision to update to), each item containing the following key/value pairs:
333 * `author` - the author of the commit.
334 * `message` - the commit message, stripped to the first line.
335 * `date` - The commit date, in the rfc822 format.
336 * `git_hash` - the git hash of the commit, (mirrored if root VCS is mercurial, 'NO MIRROR' if mirroring was skipped)
337 * `git_url` - the revisions' url @ www.github.com
338 * `hg_hash` - the mercurial hash of the commit, (mirrored if root VCS is git, 'NO MIRROR' if mirroring was skipped)
339 * `hg_url` - the revisions url @ hg.adblockplus.org
340 - `issue_ids` - A list of encountered Issue ids or an empty array.
341 - `noissues` - Changes which could not be associated with an issue id. Either an empty array, or a list of dictionaries, each containing the same key/value pair s as `raw_changes`
342 - `hg_hash` - the mercurial hash for the new revision ('NO MIRROR' if mercurial is the mirror's vcs and mirroring is skipped)
343 - `git_hash` the git hash for the new revision ('NO MIRROR' if git is the mirror 's vcs and mirroring is skipped)
344
345 For more information, please consult [the jinja2 documentation](http://jinja.poc oo.org/docs/2.9/).
346
347 ### Example template
348
349 The following template generates an issue body, from which the line in "What to change"
350 can be copied to the dependencies file.
351
352 Additionally, the hashes in the "What to change" section are hyperlinks to
353 their respective hosts.
354
355 ```
356 SUBJECT:
357 Update {{ repository }} dependency to {{ hg_hash }}
358
359 === Background ===
360
361 CHANGE ME!
362
363 === Included changes in `{{ repository }}` ===
364 The list of changes imported by this is:
365 [[TicketQuery({%- for issue_id in issue_ids -%}
366 id={{ issue_id }}{%- if not loop.last -%}&{%- endif -%}
367 {%- endfor -%}
368 ,order=id,desc=1,format=table,col=summary|component)]]
369
370 {% for change in noissues -%}
371 || [{{ change.hg_url }} {{ change.hg_hash }}] || {{ change.message }} || {{ chan ge.author }} ||
372 {% endfor %}
373
374 === What to change ===
375 Update the `{{ repository }}` dependency to:
376
377 {{ repository }} = {{ repository }} hg:[{{ raw_changes[0].hg_url }} {{ raw_chang es[0].hg_hash }}] git:[{{ raw_changes[0].git_url }} {{ raw_changes[0].git_hash } }]
378
379 || **mercurial** || **git** ||
380 || {{ hg_hash }} || {{ git_hash }} ||
381
382 === Integration Notes ===
383
384 CHANGE ME!
385
386 === Hints for testers ===
387
388 CHANGE ME!
389 ```
OLDNEW

Powered by Google App Engine
This is Rietveld