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