Mercurial > hg
annotate hgext/chainsaw.py @ 51429:bc88aa7472de
chainsaw: new extension for dangerous operations
The first provided command is `chainsaw-update`, whose one and single job is
to make sure that it will pull, update and purge the target repository,
no matter what may be in the way (locks, notably), see docstring for rationale.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Sat, 26 Nov 2022 12:23:56 +0100 |
parents | |
children | fe68a2dc0bf2 |
rev | line source |
---|---|
51429
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
1 # chainsaw.py |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
2 # |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
3 # Copyright 2022 Georges Racinet <georges.racinet@octobus.net> |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
4 # |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
7 """chainsaw is a collection of single-minded and dangerous tools. (EXPERIMENTAL) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
8 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
9 "Don't use a chainsaw to cut your food!" |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
10 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
11 The chainsaw extension provides commands that are so much geared towards a |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
12 specific use case in a specific context or environment that they are totally |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
13 inappropriate and **really dangerous** in other contexts. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
14 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
15 The help text of each command explicitly summarizes its context of application |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
16 and the wanted end result. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
17 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
18 It is recommended to run these commands with the ``HGPLAIN`` environment |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
19 variable (see :hg:`help scripting`). |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
20 """ |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
21 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
22 import shutil |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
23 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
24 from mercurial.i18n import _ |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
25 from mercurial import ( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
26 cmdutil, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
27 commands, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
28 error, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
29 registrar, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
30 ) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
31 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
32 cmdtable = {} |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
33 command = registrar.command(cmdtable) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
34 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
35 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
36 # be specifying the version(s) of Mercurial they are tested with, or |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
37 # leave the attribute unspecified. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
38 testedwith = b'ships-with-hg-core' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
39 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
40 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
41 @command( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
42 b'admin::chainsaw-update', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
43 [ |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
44 ( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
45 b'', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
46 b'purge-unknown', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
47 True, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
48 _( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
49 b'Remove unversioned files before update. Disabling this can ' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
50 b'in some cases interfere with the update.' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
51 b'See also :hg:`purge`.' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
52 ), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
53 ), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
54 ( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
55 b'', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
56 b'purge-ignored', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
57 True, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
58 _( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
59 b'Remove ignored files before update. Disable this for ' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
60 b'instance to reuse previous compiler object files. ' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
61 b'See also :hg:`purge`.' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
62 ), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
63 ), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
64 ( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
65 b'', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
66 b'rev', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
67 b'', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
68 _(b'revision to update to'), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
69 ), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
70 ( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
71 b'', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
72 b'source', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
73 b'', |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
74 _(b'repository to clone from'), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
75 ), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
76 ], |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
77 _(b'hg admin::chainsaw-update [OPTION] --rev REV --source SOURCE...'), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
78 helpbasic=True, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
79 ) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
80 def update(ui, repo, **opts): |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
81 """pull and update to a given revision, no matter what, (EXPERIMENTAL) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
82 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
83 Context of application: *some* Continuous Integration (CI) systems, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
84 packaging or deployment tools. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
85 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
86 Wanted end result: clean working directory updated at the given revision. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
87 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
88 chainsaw-update pulls from one source, then updates the working directory |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
89 to the given revision, overcoming anything that would stand in the way. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
90 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
91 By default, it will: |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
92 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
93 - break locks if needed, leading to possible corruption if there |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
94 is a concurrent write access. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
95 - perform recovery actions if needed |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
96 - revert any local modification. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
97 - purge unknown and ignored files. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
98 - go as far as to reclone if everything else failed (not implemented yet). |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
99 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
100 DO NOT use it for anything else than performing a series |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
101 of unattended updates, with full exclusive repository access each time |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
102 and without any other local work than running build scripts. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
103 In case the local repository is a share (see :hg:`help share`), exclusive |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
104 write access to the share source is also mandatory. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
105 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
106 It is recommended to run these commands with the ``HGPLAIN`` environment |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
107 variable (see :hg:`scripting`). |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
108 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
109 Motivation: in Continuous Integration and Delivery systems (CI/CD), the |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
110 occasional remnant or bogus lock are common sources of waste of time (both |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
111 working time and calendar time). CI/CD scripts tend to grow with counter- |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
112 measures, often done in urgency. Also, whilst it is neat to keep |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
113 repositories from one job to the next (especially with large |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
114 repositories), an exceptional recloning is better than missing a release |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
115 deadline. |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
116 """ |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
117 rev = opts['rev'] |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
118 source = opts['source'] |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
119 if not rev: |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
120 raise error.InputError(_(b'specify a target revision with --rev')) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
121 if not source: |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
122 raise error.InputError(_(b'specify a pull path with --source')) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
123 ui.status(_(b'breaking locks, if any\n')) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
124 repo.svfs.tryunlink(b'lock') |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
125 repo.vfs.tryunlink(b'wlock') |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
126 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
127 ui.status(_(b'recovering after interrupted transaction, if any\n')) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
128 repo.recover() |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
129 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
130 ui.status(_(b'pulling from %s\n') % source) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
131 overrides = {(b'ui', b'quiet'): True} |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
132 with ui.configoverride(overrides, b'chainsaw-update'): |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
133 pull = cmdutil.findcmd(b'pull', commands.table)[1][0] |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
134 pull(ui, repo, source, rev=[rev], remote_hidden=False) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
135 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
136 purge = cmdutil.findcmd(b'purge', commands.table)[1][0] |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
137 purge( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
138 ui, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
139 repo, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
140 dirs=True, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
141 all=opts.get('purge_ignored'), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
142 files=opts.get('purge_unknown'), |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
143 confirm=False, |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
144 ) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
145 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
146 ui.status(_(b'updating to revision \'%s\'\n') % rev) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
147 update = cmdutil.findcmd(b'update', commands.table)[1][0] |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
148 update(ui, repo, rev=rev, clean=True) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
149 |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
150 ui.status( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
151 _( |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
152 b'chainsaw-update to revision \'%s\' ' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
153 b'for repository at \'%s\' done\n' |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
154 ) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
155 % (rev, repo.root) |
bc88aa7472de
chainsaw: new extension for dangerous operations
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
156 ) |