Mercurial > evolve
annotate hgext3rd/evolve/__init__.py @ 4324:e913546b9d79
configitems: move the default values to the registrar decorator
The exthelper refactoring of configitems stopped registering dynamicdefault for
everything, which in turn causes a lot of warnings about mismatched defaults.
There are a few stragglers- I didn't fix topic-mode because I wasn't sure what
the default should be, and the alias for odiff was explicitly given a default
for compatibility.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 04 Jan 2019 00:10:44 -0500 |
parents | 00d1963f50e5 |
children | 392f1a6a0763 |
rev | line source |
---|---|
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
1 # Copyright 2011 Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
2 # Logilab SA <contact@logilab.fr> |
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
3 # Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
519
9825c7da5b54
ensure all file have a copyright notice
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
517
diff
changeset
|
4 # Patrick Mezard <patrick@mezard.eu> |
4281
ac4bb904f5d8
exthelper: clarify copyright and licence for the module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4261
diff
changeset
|
5 # Octobus <contact@octobus.net> |
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
6 # |
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
7 # This software may be used and distributed according to the terms of the |
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
8 # GNU General Public License version 2 or any later version. |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
9 """extends Mercurial feature related to Changeset Evolution |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
10 |
2292
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
11 This extension: |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
12 |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
13 - provides several commands to mutate history and deal with resulting issues, |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
14 - enable the changeset-evolution feature for Mercurial, |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
15 - improves some aspect of the early implementation in Mercurial core, |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
16 |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
17 Note that a version dedicated to server usage only (no local working copy) is |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
18 available as 'evolve.serveronly'. |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
19 |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
20 While many feature related to changeset evolution are directly handled by core |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
21 this extensions contains significant additions recommended to any user of |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
22 changeset evolution. |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
23 |
2678
da2b3e5e4f69
docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2667
diff
changeset
|
24 With the extension various evolution events will display warning (new unstable |
2292
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
25 changesets, obsolete working copy parent, improved error when accessing hidden |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
26 revision, etc). |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
27 |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
28 In addition, the extension contains better discovery protocol for obsolescence |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
29 markers. This means less obs-markers will have to be pushed and pulled around, |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
30 speeding up such operation. |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
31 |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
32 Some improvement and bug fixes available in newer version of Mercurial are also |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
33 backported to older version of Mercurial by this extension. Some older |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
34 experimental protocol are also supported for a longer time in the extensions to |
f026e85bd0b2
evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2290
diff
changeset
|
35 help people transitioning. (The extensions is currently compatible down to |
4253
35dac5aadcfc
compat: update metadata about minimum ag version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4252
diff
changeset
|
36 Mercurial version 4.4). |
2311
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
37 |
2923
8c2d3c474fc6
doc: make paragraphs before example code end with "::" for reST syntax
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2895
diff
changeset
|
38 New Config:: |
2311
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
39 |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
40 [experimental] |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
41 # Set to control the behavior when pushing draft changesets to a publishing |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
42 # repository. Possible value: |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
43 # * ignore: current core behavior (default) |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
44 # * warn: proceed with the push, but issue a warning |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
45 # * abort: abort the push |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
46 auto-publish = ignore |
26d638e419df
auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2294
diff
changeset
|
47 |
2521
29fc90b0e59c
obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2504
diff
changeset
|
48 # For some large repository with few markers, the current for obsolescence |
29fc90b0e59c
obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2504
diff
changeset
|
49 # markers discovery can get in the way. You can disable it with the |
29fc90b0e59c
obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2504
diff
changeset
|
50 # configuration option below. This means all pushes and pulls will |
29fc90b0e59c
obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2504
diff
changeset
|
51 # re-exchange all markers every time. |
29fc90b0e59c
obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2504
diff
changeset
|
52 evolution.obsdiscovery = yes |
29fc90b0e59c
obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2504
diff
changeset
|
53 |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
54 Obsolescence Markers Discovery Experiment |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
55 ========================================= |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
56 |
2550
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
57 We are experimenting with a new protocol to discover common markers between |
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
58 local and remote repositories. This experiment is still at an early stage but |
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
59 is already raising better results than the previous version (when usable). |
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
60 |
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
61 "Large" repositories (hundreds of thousand) are currently unsupported. Some key |
3225
28fb347a5bf8
typos: fix typos in several locations
Kyle Lippincott <spectral@google.com>
parents:
3198
diff
changeset
|
62 algorithm has a naive implementation with too aggressive caching, creating |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
63 memory consumption issue (this will get fixed). |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
64 |
3225
28fb347a5bf8
typos: fix typos in several locations
Kyle Lippincott <spectral@google.com>
parents:
3198
diff
changeset
|
65 Medium sized repositories works fine, but be prepared for a noticeable initial |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
66 cache filling. for the Mercurial repository, this is around 20 seconds |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
67 |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
68 The following config control the experiment:: |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
69 |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
70 [experimental] |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
71 |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
72 # enable new discovery protocol |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
73 # (needed on both client and server) |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
74 obshashrange = yes |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
75 |
3368
7310f3ef6dee
caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3365
diff
changeset
|
76 # control cache warming at the end of transaction |
7310f3ef6dee
caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3365
diff
changeset
|
77 # yes: warm all caches at the end of each transaction, |
7310f3ef6dee
caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3365
diff
changeset
|
78 # off: warm no caches at the end of transaction, |
3369
c7fbb79cd366
caches: switch to 'auto' warming by default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3368
diff
changeset
|
79 # auto: warm cache at the end of server side transaction (default). |
3368
7310f3ef6dee
caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3365
diff
changeset
|
80 obshashrange.warm-cache = 'auto' |
2475
84982b441e82
documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2465
diff
changeset
|
81 |
3690
44580b7e288b
documentation: refer to 4.3 in the help text
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3673
diff
changeset
|
82 $ hg debugupdatecache |
2715
61e73c8fe169
obshashrange: add cache warming instruction to the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2714
diff
changeset
|
83 |
3690
44580b7e288b
documentation: refer to 4.3 in the help text
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3673
diff
changeset
|
84 It is recommended to enable the blackbox extension. It gathers useful data about |
44580b7e288b
documentation: refer to 4.3 in the help text
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3673
diff
changeset
|
85 the experiment. It is shipped with Mercurial so no extra install is needed:: |
3691
96cb98989d57
evolve: use in code filtered error for 4.6
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3690
diff
changeset
|
86 $ hg debugupdatecache |
2715
61e73c8fe169
obshashrange: add cache warming instruction to the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2714
diff
changeset
|
87 |
2678
da2b3e5e4f69
docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2667
diff
changeset
|
88 It is recommended to enable the blackbox extension. It gathers useful data about |
2687
4a02781d90ce
evolve: fix documentation formatting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2678
diff
changeset
|
89 the experiment. It is shipped with Mercurial so no extra install is needed:: |
2475
84982b441e82
documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2465
diff
changeset
|
90 |
84982b441e82
documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2465
diff
changeset
|
91 [extensions] |
84982b441e82
documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2465
diff
changeset
|
92 blackbox = |
2493
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
93 |
2550
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
94 Finally some extra options are available to help tame the experimental |
2687
4a02781d90ce
evolve: fix documentation formatting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2678
diff
changeset
|
95 implementation of some of the algorithms:: |
2504
d95006fe4dd0
stablerange: use last recently used caching for revisions associated to ranges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2493
diff
changeset
|
96 |
d95006fe4dd0
stablerange: use last recently used caching for revisions associated to ranges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2493
diff
changeset
|
97 [experimental] |
d95006fe4dd0
stablerange: use last recently used caching for revisions associated to ranges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2493
diff
changeset
|
98 # restrict cache size to reduce memory consumption |
d95006fe4dd0
stablerange: use last recently used caching for revisions associated to ranges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2493
diff
changeset
|
99 obshashrange.lru-size = 2000 # default is 2000 |
d95006fe4dd0
stablerange: use last recently used caching for revisions associated to ranges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2493
diff
changeset
|
100 |
2551
ecd47c63b6de
obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2550
diff
changeset
|
101 # automatically disable obshashrange related computation and capabilities |
ecd47c63b6de
obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2550
diff
changeset
|
102 # if the repository has more than N revisions. This is meant to help large |
3225
28fb347a5bf8
typos: fix typos in several locations
Kyle Lippincott <spectral@google.com>
parents:
3198
diff
changeset
|
103 # server deployment to enable the feature on smaller repositories while |
2551
ecd47c63b6de
obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2550
diff
changeset
|
104 # ensuring no large repository will get affected. |
ecd47c63b6de
obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2550
diff
changeset
|
105 obshashrange.max-revs = 100000 # default is None |
ecd47c63b6de
obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2550
diff
changeset
|
106 |
2714
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
107 For very large repositories. it is currently recommended to disable obsmarkers |
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
108 discovery (Make sure you follow release announcement to know when you can turn |
2923
8c2d3c474fc6
doc: make paragraphs before example code end with "::" for reST syntax
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2895
diff
changeset
|
109 it back on):: |
2714
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
110 |
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
111 [experimental] |
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
112 evolution.obsdiscovery = no |
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
113 |
2493
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
114 Effect Flag Experiment |
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
115 ====================== |
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
116 |
2689
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
117 Evolve also records what changed between two evolutions of a changeset. For |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
118 example, having this information is helpful to understand what changed between |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
119 an obsolete changeset and its tipmost successors. |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
120 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
121 Evolve currently records: |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
122 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
123 - Meta changes, user, date |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
124 - Tree movement, branch and parent, did the changeset moved? |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
125 - Description, was the commit description edited |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
126 - Diff, was there apart from potential diff change due to rebase a change in the diff? |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
127 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
128 These flags are lightweight and can be combined, so it's easy to see if 4 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
129 evolutions of the same changeset has just updated the description or if the |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
130 content changed and you need to review again the diff. |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
131 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
132 The effect flag recording is enabled by default in Evolve 6.4.0 so you have |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
133 nothing to do to enjoy it. Now every new evolution that you create will have |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
134 the effect flag attached. |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
135 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
136 The following config control the effect flag recording:: |
2493
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
137 |
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
138 [experimental] |
2689
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
139 # uncomment to deactivate the registration of effect flags in obs markers |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
140 # evolution.effect-flags = false |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
141 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
142 You can display the effect flags with the command obslog, so if you have a |
2923
8c2d3c474fc6
doc: make paragraphs before example code end with "::" for reST syntax
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2895
diff
changeset
|
143 changeset and you update only the message, you will see:: |
2689
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
144 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
145 $ hg commit -m "WIP |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
146 $ hg commit -m "A better commit message!" |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
147 $ hg obslog . |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
148 @ 8e9045855628 (3133) A better commit message! |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
149 | |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
150 x 7863a5bb5763 (3132) WIP |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
151 rewritten(description) by Boris Feld <boris.feld@octobus.net> (Fri Jun 02 12:00:24 2017 +0200) as 8e9045855628 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
152 |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
153 Servers does not need to activate the effect flag recording. Effect flags that |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
154 you create will not cause interference with other clients or servers without |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
155 the effect flag recording. |
2556
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
156 |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
157 Templates |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
158 ========= |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
159 |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
160 Evolve ship several templates that you can use to have a better visibility |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
161 about your obs history: |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
162 |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
163 - precursors, for each obsolete changeset show the closest visible |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
164 precursors. |
3225
28fb347a5bf8
typos: fix typos in several locations
Kyle Lippincott <spectral@google.com>
parents:
3198
diff
changeset
|
165 - successors, for each obsolete changeset show the closest visible |
2556
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
166 successors. It is useful when your working directory is obsolete to see |
2678
da2b3e5e4f69
docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2667
diff
changeset
|
167 what are its successors. This information can also be retrieved with the |
2556
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
168 obslog command and the --all option. |
2591
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
169 - obsfate, for each obsolete changeset display a line summarizing what |
3225
28fb347a5bf8
typos: fix typos in several locations
Kyle Lippincott <spectral@google.com>
parents:
3198
diff
changeset
|
170 changed between the changeset and its successors. Depending on the |
2591
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
171 verbosity level (-q and -v) it display the changeset successors, the users |
2678
da2b3e5e4f69
docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2667
diff
changeset
|
172 that created the obsmarkers and the date range of these changes. |
2591
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
173 |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
174 The template itself is not complex, the data are basically a list of |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
175 successortset. Each successorset is a dict with these fields: |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
176 |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
177 - "verb", how did the revision changed, pruned or rewritten for the moment |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
178 - "users" a sorted list of users that have create obs marker between current |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
179 changeset and one of its successor |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
180 - "min_date" the tiniest date of the first obs marker between current |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
181 changeset and one of its successor |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
182 - "max_date" the biggest date between current changeset and one of its |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
183 successor |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
184 - "successors" a sorted list of locally know successors node ids |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
185 - "markers" the raw list of changesets. |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
186 """ |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
187 |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
188 evolutionhelptext = """ |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
189 Obsolescence markers make it possible to mark changesets that have been |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
190 deleted or superset in a new version of the changeset. |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
191 |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
192 Unlike the previous way of handling such changes, by stripping the old |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
193 changesets from the repository, obsolescence markers can be propagated |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
194 between repositories. This allows for a safe and simple way of exchanging |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
195 mutable history and altering it after the fact. Changeset phases are |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
196 respected, such that only draft and secret changesets can be altered (see |
1709
989ed2f30d41
help: fix evolution hg phases reference
timeless@gmail.com
parents:
1702
diff
changeset
|
197 :hg:`help phases` for details). |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
198 |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
199 Obsolescence is tracked using "obsolete markers", a piece of metadata |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
200 tracking which changesets have been made obsolete, potential successors for |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
201 a given changeset, the moment the changeset was marked as obsolete, and the |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
202 user who performed the rewriting operation. The markers are stored |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
203 separately from standard changeset data can be exchanged without any of the |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
204 precursor changesets, preventing unnecessary exchange of obsolescence data. |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
205 |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
206 The complete set of obsolescence markers describes a history of changeset |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
207 modifications that is orthogonal to the repository history of file |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
208 modifications. This changeset history allows for detection and automatic |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
209 resolution of edge cases arising from multiple users rewriting the same part |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
210 of history concurrently. |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
211 |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
212 Current feature status |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
213 ====================== |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
214 |
1710 | 215 This feature is still in development. If you see this help, you have enabled an |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
216 extension that turned this feature on. |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
217 |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
218 Obsolescence markers will be exchanged between repositories that explicitly |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
219 assert support for the obsolescence feature (this can currently only be done |
2782
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
220 via an extension). |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
221 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
222 Instability |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
223 ========== |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
224 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
225 (note: the vocabulary is in the process of being updated) |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
226 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
227 Rewriting changesets might introduce instability (currently 'trouble'). |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
228 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
229 There are two main kinds of instability: orphaning and diverging. |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
230 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
231 Orphans are changesets left behind when their ancestors are rewritten, (currently: 'unstable'). |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
232 Divergence has two variants: |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
233 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
234 * Content-divergence occurs when independent rewrites of the same changesets |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
235 lead to different results. (currently: 'divergent') |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
236 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
237 * Phase-divergence occurs when the old (obsolete) version of a changeset |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
238 becomes public. (currently: 'bumped') |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
239 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
240 If it possible to prevent local creation of orphans by using the following config:: |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
241 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
242 [experimental] |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
243 evolution=createmarkers,allnewcommands,exchange |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
244 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
245 You can also enable that option explicitly:: |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
246 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
247 [experimental] |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
248 evolution=createmarkers,allnewcommands,allowunstable,exchange |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
249 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
250 or simply:: |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
251 |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
252 [experimental] |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
253 evolution=all |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
254 """.strip() |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
255 |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
256 import sys |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
257 import struct |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
258 |
1678 | 259 try: |
260 import StringIO as io | |
261 StringIO = io.StringIO | |
262 except ImportError: | |
263 import io | |
264 StringIO = io.StringIO | |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
265 |
481
4e0f1aae8d24
evolve: touch command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
477
diff
changeset
|
266 |
1825
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
267 try: |
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
268 from mercurial import registrar |
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
269 registrar.templatekeyword # new in hg-3.8 |
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
270 except ImportError: |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
271 from . import metadata |
2895
e4ee0b6170e9
compat: make it more clear that evolve need Mercurial >= minversion
Philippe Pepiot <phil@philpep.org>
parents:
2859
diff
changeset
|
272 raise ImportError('evolve needs Mercurial version %s or above' % |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
273 min(metadata.testedwith.split())) |
1825
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
274 |
670
97ce1f801309
evolve: drop unused import
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
663
diff
changeset
|
275 import mercurial |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
276 from mercurial import util |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
277 |
1834
f23a97d14895
compat: drop compat for older wireproto implementation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1833
diff
changeset
|
278 from mercurial import obsolete |
f23a97d14895
compat: drop compat for older wireproto implementation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1833
diff
changeset
|
279 if not obsolete._enabled: |
f23a97d14895
compat: drop compat for older wireproto implementation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1833
diff
changeset
|
280 obsolete._enabled = True |
617
469befc27b26
detect incompatibility with future mercurial 2.5
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
616
diff
changeset
|
281 |
1823
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
282 from mercurial import ( |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
283 bookmarks as bookmarksmod, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
284 cmdutil, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
285 commands, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
286 context, |
2465
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
287 dirstate, |
1823
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
288 error, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
289 help, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
290 hg, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
291 lock as lockmod, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
292 node, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
293 patch, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
294 revset, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
295 scmutil, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
296 ) |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
297 |
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
298 from mercurial.i18n import _ |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
299 from mercurial.node import nullid |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
300 |
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
301 from . import ( |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
2524
diff
changeset
|
302 compat, |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2122
diff
changeset
|
303 debugcmd, |
2772
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
304 cmdrewrite, |
3457
82e9f9603b1b
evolvestate: rename the file to state.py and class name to cmdstate
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3456
diff
changeset
|
305 state, |
3461
6475d2046f87
evolvecmd: introduce a new module to handle `hg evolve` related code
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3460
diff
changeset
|
306 evolvecmd, |
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
307 exthelper, |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
308 metadata, |
2294
75996eafab43
perf: adds some cache key helper on the obsstore class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2293
diff
changeset
|
309 obscache, |
75996eafab43
perf: adds some cache key helper on the obsstore class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2293
diff
changeset
|
310 obsexchange, |
2524
d912380ec685
evolve: fix import order
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2521
diff
changeset
|
311 obshistory, |
3858
bb4f5ad63877
rewind: add a proto version of the command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3839
diff
changeset
|
312 rewind, |
2756
f4dd6e6d4c73
rewriteutil: create a rewriteutil module to host utility function
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2755
diff
changeset
|
313 rewriteutil, |
2286
a4c5744a7b93
safeguard: add an option to disable automatic publishing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2275
diff
changeset
|
314 safeguard, |
2524
d912380ec685
evolve: fix import order
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2521
diff
changeset
|
315 templatekw, |
2047
ce39d0f9976d
serveronly: give the sub extension a way to access to the 'evolve' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2044
diff
changeset
|
316 utility, |
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
317 ) |
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
318 |
3373
3ff0da45d4c7
evolve: use compat.TROUBLES to show troubles in user interface
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3369
diff
changeset
|
319 TROUBLES = compat.TROUBLES |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
320 __version__ = metadata.__version__ |
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
321 testedwith = metadata.testedwith |
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
322 minimumhgversion = metadata.minimumhgversion |
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
323 buglink = metadata.buglink |
1838
6942750831bb
serveronly: deduplicate code with the main evolve extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1836
diff
changeset
|
324 |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
325 # Flags for enabling optional parts of evolve |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
326 commandopt = 'allnewcommands' |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
327 |
2047
ce39d0f9976d
serveronly: give the sub extension a way to access to the 'evolve' module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2044
diff
changeset
|
328 obsexcmsg = utility.obsexcmsg |
2763
4a5b0c373e65
commands: move the touch to the 'evocommands' module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2762
diff
changeset
|
329 shorttemplate = utility.shorttemplate |
1838
6942750831bb
serveronly: deduplicate code with the main evolve extension
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1836
diff
changeset
|
330 |
2404
c07f752137f4
label: rename 'evolve.short_node' to 'evolve.node'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2403
diff
changeset
|
331 colortable = {'evolve.node': 'yellow', |
2337
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
332 'evolve.user': 'green', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
333 'evolve.rev': 'blue', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
334 'evolve.short_description': '', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
335 'evolve.date': 'cyan', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
336 'evolve.current_rev': 'bold', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
337 'evolve.verb': '', |
3501
7c8150697810
color: add some colors to evolve command itself
Boris Feld <boris.feld@octobus.net>
parents:
3484
diff
changeset
|
338 'evolve.operation': 'bold' |
2337
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
339 } |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
340 |
820
a9a66143e2ec
exchange: actually use _pushkeyescape fallback
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
819
diff
changeset
|
341 _pack = struct.pack |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
342 _unpack = struct.unpack |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
343 |
1296
23819e1d61fd
evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents:
1281
diff
changeset
|
344 aliases, entry = cmdutil.findcmd('commit', commands.table) |
2772
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
345 commitopts3 = cmdrewrite.commitopts3 |
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
346 interactiveopt = cmdrewrite.interactiveopt |
2759
3137185b1bfe
rewriteutil: move the 'rewrite' function
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2758
diff
changeset
|
347 rewrite = rewriteutil.rewrite |
2724
e6bc6eaa17c5
amend: extract into a 'evolve.evocommands' module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2716
diff
changeset
|
348 |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
349 # This extension contains the following code |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
350 # |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
351 # - Extension Helper code |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
352 # - Obsolescence cache |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
353 # - ... |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
354 # - Older format compat |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
355 |
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
356 eh = exthelper.exthelper() |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2122
diff
changeset
|
357 eh.merge(debugcmd.eh) |
3470
ece5cd58147d
evolve: move the evolve command to evolvecmd.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3469
diff
changeset
|
358 eh.merge(evolvecmd.eh) |
2053
f3765c4a352a
exchange: rename the module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2051
diff
changeset
|
359 eh.merge(obsexchange.eh) |
2286
a4c5744a7b93
safeguard: add an option to disable automatic publishing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2275
diff
changeset
|
360 eh.merge(safeguard.eh) |
2294
75996eafab43
perf: adds some cache key helper on the obsstore class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2293
diff
changeset
|
361 eh.merge(obscache.eh) |
2415
89a5dabbb43d
obshistory: move the command into the obshistory module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2414
diff
changeset
|
362 eh.merge(obshistory.eh) |
2485
e6ecd35e99ec
refactor: extract templates into a new file
Boris Feld <boris.feld@octobus.net>
parents:
2481
diff
changeset
|
363 eh.merge(templatekw.eh) |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
2524
diff
changeset
|
364 eh.merge(compat.eh) |
2772
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
365 eh.merge(cmdrewrite.eh) |
3858
bb4f5ad63877
rewind: add a proto version of the command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3839
diff
changeset
|
366 eh.merge(rewind.eh) |
4321
00d1963f50e5
exthelper: remove '_' in final_xxx() function names to conform to hg style
Matt Harbison <matt_harbison@yahoo.com>
parents:
4281
diff
changeset
|
367 uisetup = eh.finaluisetup |
00d1963f50e5
exthelper: remove '_' in final_xxx() function names to conform to hg style
Matt Harbison <matt_harbison@yahoo.com>
parents:
4281
diff
changeset
|
368 extsetup = eh.finalextsetup |
00d1963f50e5
exthelper: remove '_' in final_xxx() function names to conform to hg style
Matt Harbison <matt_harbison@yahoo.com>
parents:
4281
diff
changeset
|
369 reposetup = eh.finalreposetup |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
370 cmdtable = eh.cmdtable |
3080
461c9d940519
evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents:
3074
diff
changeset
|
371 configtable = eh.configtable |
461c9d940519
evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents:
3074
diff
changeset
|
372 |
461c9d940519
evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents:
3074
diff
changeset
|
373 # Configuration |
4324
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
374 eh.configitem('experimental', 'evolutioncommands', []) |
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
375 eh.configitem('experimental', 'evolution.allnewcommands', None) |
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
376 eh.configitem('experimental', 'prunestrip', False) |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
377 |
2465
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
378 # pre hg 4.0 compat |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
379 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
380 if not util.safehasattr(dirstate.dirstate, 'parentchange'): |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
381 import contextlib |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
382 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
383 @contextlib.contextmanager |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
384 def parentchange(self): |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
385 '''Context manager for handling dirstate parents. |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
386 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
387 If an exception occurs in the scope of the context manager, |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
388 the incoherent dirstate won't be written when wlock is |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
389 released. |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
390 ''' |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
391 self._parentwriters += 1 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
392 yield |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
393 # Typically we want the "undo" step of a context manager in a |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
394 # finally block so it happens even when an exception |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
395 # occurs. In this case, however, we only want to decrement |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
396 # parentwriters if the code in the with statement exits |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
397 # normally, so we don't have a try/finally here on purpose. |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
398 self._parentwriters -= 1 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
399 dirstate.dirstate.parentchange = parentchange |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
400 |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
401 ##################################################################### |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
402 ### Option configuration ### |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
403 ##################################################################### |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
404 |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
405 @eh.reposetup # must be the first of its kin. |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
406 def _configureoptions(ui, repo): |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
407 # If no capabilities are specified, enable everything. |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
408 # This is so existing evolve users don't need to change their config. |
3185
0c64d0242ac2
config: clarify that config is only enabled on the repository is it setup for
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3155
diff
changeset
|
409 evolveopts = repo.ui.configlist('experimental', 'evolution') |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
410 if not evolveopts: |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
411 evolveopts = ['all'] |
3185
0c64d0242ac2
config: clarify that config is only enabled on the repository is it setup for
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3155
diff
changeset
|
412 repo.ui.setconfig('experimental', 'evolution', evolveopts, 'evolve') |
3149
79a926b557f1
compat: drop support for older exchange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3141
diff
changeset
|
413 if obsolete.isenabled(repo, 'exchange'): |
3510
3bd642f11313
legacy: respect explicit config for server.bundle1
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3483
diff
changeset
|
414 # if no config explicitly set, disable bundle1 |
3bd642f11313
legacy: respect explicit config for server.bundle1
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3483
diff
changeset
|
415 if not isinstance(repo.ui.config('server', 'bundle1'), str): |
3bd642f11313
legacy: respect explicit config for server.bundle1
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3483
diff
changeset
|
416 repo.ui.setconfig('server', 'bundle1', False) |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
417 |
3365
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
418 class trdescrepo(repo.__class__): |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
419 |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
420 def transaction(self, desc, *args, **kwargs): |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
421 tr = super(trdescrepo, self).transaction(desc, *args, **kwargs) |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
422 tr.desc = desc |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
423 return tr |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
424 |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
425 repo.__class__ = trdescrepo |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
426 |
1226
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
427 @eh.uisetup |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
428 def _configurecmdoptions(ui): |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
429 # Unregister evolve commands if the command capability is not specified. |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
430 # |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
431 # This must be in the same function as the option configuration above to |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
432 # guarantee it happens after the above configuration, but before the |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
433 # extsetup functions. |
4324
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
434 evolvecommands = ui.configlist('experimental', 'evolutioncommands') |
1226
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
435 evolveopts = ui.configlist('experimental', 'evolution') |
4235
e30119dfd626
style: fix various flake8 warning
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4184
diff
changeset
|
436 if evolveopts and (commandopt not in evolveopts |
e30119dfd626
style: fix various flake8 warning
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4184
diff
changeset
|
437 and 'all' not in evolveopts): |
1441
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
438 # We build whitelist containing the commands we want to enable |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
439 whitelist = set() |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
440 for cmd in evolvecommands: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
441 matchingevolvecommands = [e for e in cmdtable.keys() if cmd in e] |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
442 if not matchingevolvecommands: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
443 raise error.Abort(_('unknown command: %s') % cmd) |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
444 elif len(matchingevolvecommands) > 1: |
1547
425c0700aabd
check-code: make evolve.py comply with check-code
Laurent Charignon <lcharignon@fb.com>
parents:
1536
diff
changeset
|
445 msg = _('ambiguous command specification: "%s" matches %r') |
425c0700aabd
check-code: make evolve.py comply with check-code
Laurent Charignon <lcharignon@fb.com>
parents:
1536
diff
changeset
|
446 raise error.Abort(msg % (cmd, matchingevolvecommands)) |
1441
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
447 else: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
448 whitelist.add(matchingevolvecommands[0]) |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
449 for disabledcmd in set(cmdtable) - whitelist: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
450 del cmdtable[disabledcmd] |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
451 |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
452 ##################################################################### |
805
66c02a2e8e2f
prune: wrap mercurial internal to add parent information in prune marker
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
804
diff
changeset
|
453 ### experimental behavior ### |
66c02a2e8e2f
prune: wrap mercurial internal to add parent information in prune marker
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
804
diff
changeset
|
454 ##################################################################### |
66c02a2e8e2f
prune: wrap mercurial internal to add parent information in prune marker
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
804
diff
changeset
|
455 |
590
02cadd3dc9f4
evolve: adapt to 2.4 code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
589
diff
changeset
|
456 getrevs = obsolete.getrevs |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
457 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
458 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
459 ### Additional Utilities ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
460 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
461 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
462 # This section contains a lot of small utility function and method |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
463 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
464 # - Function to create markers |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
465 # - useful alias pstatus and pdiff (should probably go in evolve) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
466 # - "troubles" method on changectx |
1661 | 467 # - function to travel through the obsolescence graph |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
468 # - function to find useful changeset to stabilize |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
469 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
470 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
471 ### Useful alias |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
472 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
473 @eh.uisetup |
2953
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
474 def setupparentcommand(ui): |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
475 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
476 _alias, statuscmd = cmdutil.findcmd('status', commands.table) |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
477 pstatusopts = [o for o in statuscmd[1] if o[1] != 'rev'] |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
478 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
479 @eh.command('pstatus', pstatusopts) |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
480 def pstatus(ui, repo, *args, **kwargs): |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
481 """show status combining committed and uncommited changes |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
482 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
483 This show the combined status of the current working copy parent commit and |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
484 the uncommitted change in the working copy itself. The status displayed |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
485 match the content of the commit that a bare :hg:`amend` will creates. |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
486 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
487 See :hg:`help status` for details.""" |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
488 kwargs['rev'] = ['.^'] |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
489 return statuscmd[0](ui, repo, *args, **kwargs) |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
490 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
491 _alias, diffcmd = cmdutil.findcmd('diff', commands.table) |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
492 pdiffopts = [o for o in diffcmd[1] if o[1] != 'rev'] |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
493 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
494 @eh.command('pdiff', pdiffopts) |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
495 def pdiff(ui, repo, *args, **kwargs): |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
496 """show diff combining committed and uncommited changes |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
497 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
498 This show the combined diff of the current working copy parent commit and |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
499 the uncommitted change in the working copy itself. The diff displayed |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
500 match the content of the commit that a bare :hg:`amend` will creates. |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
501 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
502 See :hg:`help diff` for details.""" |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
503 kwargs['rev'] = ['.^'] |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
504 return diffcmd[0](ui, repo, *args, **kwargs) |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
505 |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
506 @eh.uisetup |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
507 def _installalias(ui): |
3615
1ff7ff53d81f
compat: provide an explicit default value to the 'odiff' config
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3605
diff
changeset
|
508 if ui.config('alias', 'odiff', None) is None: |
949
2b2a4ab0eb68
evolve: make most line lenghts 80 characters or less
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
948
diff
changeset
|
509 ui.setconfig('alias', 'odiff', |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
510 "diff --hidden --rev 'limit(precursors(.),1)' --rev .", |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
511 'evolve') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
512 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
513 ### Troubled revset symbol |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
514 |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
515 @eh.revset('troubled()') |
594 | 516 def revsettroubled(repo, subset, x): |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
517 """Changesets with troubles. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
518 """ |
993
8a4a8fe50c26
evolve: do not use _ as an unused variable
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
988
diff
changeset
|
519 revset.getargs(x, 0, 0, 'troubled takes no arguments') |
1381
61849d45d47e
evolve: move 'troubled()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1380
diff
changeset
|
520 troubled = set() |
2845
9fc6a4615ae5
revset: unstable volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2844
diff
changeset
|
521 troubled.update(getrevs(repo, 'orphan')) |
2847
a1805a65ce21
revset: bumped volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2846
diff
changeset
|
522 troubled.update(getrevs(repo, 'phasedivergent')) |
2846
9c019996bce0
revset: divergent volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2845
diff
changeset
|
523 troubled.update(getrevs(repo, 'contentdivergent')) |
1381
61849d45d47e
evolve: move 'troubled()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1380
diff
changeset
|
524 troubled = revset.baseset(troubled) |
61849d45d47e
evolve: move 'troubled()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1380
diff
changeset
|
525 troubled.sort() # set is non-ordered, enforce order |
61849d45d47e
evolve: move 'troubled()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1380
diff
changeset
|
526 return subset & troubled |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
527 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
528 ### Obsolescence graph |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
529 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
530 # XXX SOME MAJOR CLEAN UP TO DO HERE XXX |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
531 |
3870
e0bf44befd6e
evolve: exclude "identical" precursors from the precursors set
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3858
diff
changeset
|
532 def _precursors(repo, s, includeidentical=False): |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
533 """Precursor of a changeset""" |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
534 cs = set() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
535 nm = repo.changelog.nodemap |
2840
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2838
diff
changeset
|
536 markerbysubj = repo.obsstore.predecessors |
1377
01bdeb847f81
evolve: avoid creating changectx object in _precursors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1376
diff
changeset
|
537 node = repo.changelog.node |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
538 for r in s: |
1377
01bdeb847f81
evolve: avoid creating changectx object in _precursors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1376
diff
changeset
|
539 for p in markerbysubj.get(node(r), ()): |
3870
e0bf44befd6e
evolve: exclude "identical" precursors from the precursors set
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3858
diff
changeset
|
540 if not includeidentical and p[2] & rewind.identicalflag: |
e0bf44befd6e
evolve: exclude "identical" precursors from the precursors set
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3858
diff
changeset
|
541 continue |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
542 pr = nm.get(p[0]) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
543 if pr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
544 cs.add(pr) |
1383
cf62abb62941
evolve: move 'precursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1382
diff
changeset
|
545 cs -= repo.changelog.filteredrevs # nodemap has no filtering |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
546 return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
547 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
548 def _allprecursors(repo, s): # XXX we need a better naming |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
549 """transitive precursors of a subset""" |
1378
a127f0f3bf5f
evolve: avoid creating changectx object in _allprecursors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1377
diff
changeset
|
550 node = repo.changelog.node |
a127f0f3bf5f
evolve: avoid creating changectx object in _allprecursors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1377
diff
changeset
|
551 toproceed = [node(r) for r in s] |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
552 seen = set() |
2840
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2838
diff
changeset
|
553 allsubjects = repo.obsstore.predecessors |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
554 while toproceed: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
555 nc = toproceed.pop() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
556 for mark in allsubjects.get(nc, ()): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
557 np = mark[0] |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
558 if np not in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
559 seen.add(np) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
560 toproceed.append(np) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
561 nm = repo.changelog.nodemap |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
562 cs = set() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
563 for p in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
564 pr = nm.get(p) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
565 if pr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
566 cs.add(pr) |
1384
64c8b8c27811
evolve: move 'allprecursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1383
diff
changeset
|
567 cs -= repo.changelog.filteredrevs # nodemap has no filtering |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
568 return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
569 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
570 def _successors(repo, s): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
571 """Successors of a changeset""" |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
572 cs = set() |
1379
693cdcd809f2
evolve: avoid creating changectx object in _successors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1378
diff
changeset
|
573 node = repo.changelog.node |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
574 nm = repo.changelog.nodemap |
590
02cadd3dc9f4
evolve: adapt to 2.4 code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
589
diff
changeset
|
575 markerbyobj = repo.obsstore.successors |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
576 for r in s: |
1379
693cdcd809f2
evolve: avoid creating changectx object in _successors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1378
diff
changeset
|
577 for p in markerbyobj.get(node(r), ()): |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
578 for sub in p[1]: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
579 sr = nm.get(sub) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
580 if sr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
581 cs.add(sr) |
1385
c2584407afbf
evolve: move 'successors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1384
diff
changeset
|
582 cs -= repo.changelog.filteredrevs # nodemap has no filtering |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
583 return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
584 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
585 def _allsuccessors(repo, s, haltonflags=0): # XXX we need a better naming |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
586 """transitive successors of a subset |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
587 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
588 haltonflags allows to provide flags which prevent the evaluation of a |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
589 marker. """ |
1380
43dcf62237be
evolve: avoid creating changectx object in _allsuccessors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1379
diff
changeset
|
590 node = repo.changelog.node |
43dcf62237be
evolve: avoid creating changectx object in _allsuccessors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1379
diff
changeset
|
591 toproceed = [node(r) for r in s] |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
592 seen = set() |
590
02cadd3dc9f4
evolve: adapt to 2.4 code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
589
diff
changeset
|
593 allobjects = repo.obsstore.successors |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
594 while toproceed: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
595 nc = toproceed.pop() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
596 for mark in allobjects.get(nc, ()): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
597 if mark[2] & haltonflags: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
598 continue |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
599 for sub in mark[1]: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
600 if sub == nullid: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
601 continue # should not be here! |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
602 if sub not in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
603 seen.add(sub) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
604 toproceed.append(sub) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
605 nm = repo.changelog.nodemap |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
606 cs = set() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
607 for s in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
608 sr = nm.get(s) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
609 if sr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
610 cs.add(sr) |
1386
b5eaec8a53d0
evolve: move 'allsuccessors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1385
diff
changeset
|
611 cs -= repo.changelog.filteredrevs # nodemap has no filtering |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
612 return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
613 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
614 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
615 ### Extending revset and template ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
616 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
617 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
618 # this section add several useful revset symbol not yet in core. |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
619 # they are subject to changes |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
620 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
621 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
622 ### XXX I'm not sure this revset is useful |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
623 @eh.revset('suspended()') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
624 def revsetsuspended(repo, subset, x): |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
625 """Obsolete changesets with non-obsolete descendants. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
626 """ |
1307
677c5da57b9c
evolve: remove unused variables
Laurent Charignon <lcharignon@fb.com>
parents:
1306
diff
changeset
|
627 revset.getargs(x, 0, 0, 'suspended takes no arguments') |
1382
c431f827f366
evolve: move 'suspended()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1381
diff
changeset
|
628 suspended = revset.baseset(getrevs(repo, 'suspended')) |
c431f827f366
evolve: move 'suspended()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1381
diff
changeset
|
629 suspended.sort() |
c431f827f366
evolve: move 'suspended()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1381
diff
changeset
|
630 return subset & suspended |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
631 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
632 |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
633 @eh.revset('precursors(set)') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
634 def revsetprecursors(repo, subset, x): |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
635 """Immediate precursors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
636 """ |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
637 s = revset.getset(repo, revset.fullreposet(repo), x) |
1383
cf62abb62941
evolve: move 'precursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1382
diff
changeset
|
638 s = revset.baseset(_precursors(repo, s)) |
cf62abb62941
evolve: move 'precursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1382
diff
changeset
|
639 s.sort() |
cf62abb62941
evolve: move 'precursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1382
diff
changeset
|
640 return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
641 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
642 |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
643 @eh.revset('allprecursors(set)') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
644 def revsetallprecursors(repo, subset, x): |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
645 """Transitive precursors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
646 """ |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
647 s = revset.getset(repo, revset.fullreposet(repo), x) |
1384
64c8b8c27811
evolve: move 'allprecursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1383
diff
changeset
|
648 s = revset.baseset(_allprecursors(repo, s)) |
64c8b8c27811
evolve: move 'allprecursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1383
diff
changeset
|
649 s.sort() |
64c8b8c27811
evolve: move 'allprecursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1383
diff
changeset
|
650 return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
651 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
652 |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
653 @eh.revset('successors(set)') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
654 def revsetsuccessors(repo, subset, x): |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
655 """Immediate successors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
656 """ |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
657 s = revset.getset(repo, revset.fullreposet(repo), x) |
1385
c2584407afbf
evolve: move 'successors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1384
diff
changeset
|
658 s = revset.baseset(_successors(repo, s)) |
c2584407afbf
evolve: move 'successors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1384
diff
changeset
|
659 s.sort() |
c2584407afbf
evolve: move 'successors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1384
diff
changeset
|
660 return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
661 |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
662 @eh.revset('allsuccessors(set)') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
663 def revsetallsuccessors(repo, subset, x): |
2925
9efedcedd9dd
evolve: use registrar.revsetpredicate to register revset predicate functions
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
2923
diff
changeset
|
664 """Transitive successors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
665 """ |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
666 s = revset.getset(repo, revset.fullreposet(repo), x) |
1386
b5eaec8a53d0
evolve: move 'allsuccessors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1385
diff
changeset
|
667 s = revset.baseset(_allsuccessors(repo, s)) |
b5eaec8a53d0
evolve: move 'allsuccessors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1385
diff
changeset
|
668 s.sort() |
b5eaec8a53d0
evolve: move 'allsuccessors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1385
diff
changeset
|
669 return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
670 |
1399
9ff6d9240f16
template: add a troubles keyword
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
949
diff
changeset
|
671 |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
672 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
673 ### Various trouble warning ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
674 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
675 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
676 # This section take care of issue warning to the user when troubles appear |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
677 |
3363
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
678 def _warnobsoletewc(ui, repo, prevnode=None, wasobs=None): |
2289
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
679 rev = repo['.'] |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
680 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
681 if not rev.obsolete(): |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
682 return |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
683 |
3363
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
684 if rev.node() == prevnode and wasobs: |
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
685 return |
2289
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
686 msg = _("working directory parent is obsolete! (%s)\n") |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
687 shortnode = node.short(rev.node()) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
688 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
689 ui.warn(msg % shortnode) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
690 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
691 # Check that evolve is activated for performance reasons |
3455
f7ecb11d71bb
update: show "use 'hg evolve' to..." hint iff evolve command enabled
Martin von Zweigbergk <martinvonz@google.com>
parents:
3427
diff
changeset
|
692 evolvecommandenabled = any('evolve' in e for e in cmdtable) |
f7ecb11d71bb
update: show "use 'hg evolve' to..." hint iff evolve command enabled
Martin von Zweigbergk <martinvonz@google.com>
parents:
3427
diff
changeset
|
693 if ui.quiet or not evolvecommandenabled: |
2289
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
694 return |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
695 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
696 # Show a warning for helping the user to solve the issue |
2488
1bdbe8f55339
refactor: extract obs fate algorithm from _getobsoletereason
Boris Feld <boris.feld@octobus.net>
parents:
2485
diff
changeset
|
697 reason, successors = obshistory._getobsfateandsuccs(repo, rev.node()) |
2289
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
698 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
699 if reason == 'pruned': |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
700 solvemsg = _("use 'hg evolve' to update to its parent successor") |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
701 elif reason == 'diverged': |
3154
406992d0d611
evolve: rename --contentdivergent flag to --content-divergent
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3149
diff
changeset
|
702 debugcommand = "hg evolve --list --content-divergent" |
2289
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
703 basemsg = _("%s has diverged, use '%s' to resolve the issue") |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
704 solvemsg = basemsg % (shortnode, debugcommand) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
705 elif reason == 'superseed': |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
706 msg = _("use 'hg evolve' to update to its successor: %s") |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
707 solvemsg = msg % successors[0] |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
708 elif reason == 'superseed_split': |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
709 msg = _("use 'hg evolve' to update to its tipmost successor: %s") |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
710 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
711 if len(successors) <= 2: |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
712 solvemsg = msg % ", ".join(successors) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
713 else: |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
714 firstsuccessors = ", ".join(successors[:2]) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
715 remainingnumber = len(successors) - 2 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
716 successorsmsg = _("%s and %d more") % (firstsuccessors, remainingnumber) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
717 solvemsg = msg % successorsmsg |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
718 else: |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
719 raise ValueError(reason) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
720 |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
721 ui.warn("(%s)\n" % solvemsg) |
1527
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
722 |
3691
96cb98989d57
evolve: use in code filtered error for 4.6
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3690
diff
changeset
|
723 if util.safehasattr(context, '_filterederror'): # <= hg-4.5 |
3705
bd236590d127
wrapping: fix a silly error were we checking on module and wrapping the other
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3699
diff
changeset
|
724 @eh.wrapfunction(context, '_filterederror') |
2293
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
725 def evolve_filtererror(original, repo, changeid): |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
726 """build an exception to be raised about a filtered changeid |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
727 |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
728 This is extracted in a function to help extensions (eg: evolve) to |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
729 experiment with various message variants.""" |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
730 if repo.filtername.startswith('visible'): |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
731 |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
732 unfilteredrepo = repo.unfiltered() |
3691
96cb98989d57
evolve: use in code filtered error for 4.6
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3690
diff
changeset
|
733 rev = repo[scmutil.revsingle(unfilteredrepo, changeid)] |
2488
1bdbe8f55339
refactor: extract obs fate algorithm from _getobsoletereason
Boris Feld <boris.feld@octobus.net>
parents:
2485
diff
changeset
|
734 reason, successors = obshistory._getobsfateandsuccs(unfilteredrepo, rev.node()) |
2293
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
735 |
3691
96cb98989d57
evolve: use in code filtered error for 4.6
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3690
diff
changeset
|
736 # Be more precise in case the revision is superseed |
2293
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
737 if reason == 'superseed': |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
738 reason = _("successor: %s") % successors[0] |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
739 elif reason == 'superseed_split': |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
740 if len(successors) <= 2: |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
741 reason = _("successors: %s") % ", ".join(successors) |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
742 else: |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
743 firstsuccessors = ", ".join(successors[:2]) |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
744 remainingnumber = len(successors) - 2 |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
745 successorsmsg = _("%s and %d more") % (firstsuccessors, remainingnumber) |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
746 reason = _("successors: %s") % successorsmsg |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
747 |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
748 msg = _("hidden revision '%s'") % changeid |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
749 hint = _('use --hidden to access hidden revisions; %s') % reason |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
750 return error.FilteredRepoLookupError(msg, hint=hint) |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
751 msg = _("filtered revision '%s' (not in '%s' subset)") |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
752 msg %= (changeid, repo.filtername) |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
753 return error.FilteredRepoLookupError(msg) |
1659b42c28c2
compat: only install the better filtered message for mercurial 4.2 and above
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2292
diff
changeset
|
754 |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
755 @eh.wrapcommand("update") |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
756 @eh.wrapcommand("pull") |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
757 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
758 """Warn that the working directory parent is an obsolete changeset""" |
3363
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
759 ctx = repo['.'] |
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
760 node = ctx.node() |
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
761 isobs = ctx.obsolete() |
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
762 |
1452
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
763 def warnobsolete(): |
3363
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
764 _warnobsoletewc(ui, repo, node, isobs) |
1452
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
765 wlock = None |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
766 try: |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
767 wlock = repo.wlock() |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
768 repo._afterlock(warnobsolete) |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
769 res = origfn(ui, repo, *args, **opts) |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
770 finally: |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
771 lockmod.release(wlock) |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
772 return res |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
773 |
1527
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
774 @eh.wrapcommand("parents") |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
775 def wrapparents(origfn, ui, repo, *args, **opts): |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
776 res = origfn(ui, repo, *args, **opts) |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
777 _warnobsoletewc(ui, repo) |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
778 return res |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
779 |
1122
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
780 @eh.wrapfunction(mercurial.exchange, 'push') |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
781 def push(orig, repo, *args, **opts): |
492
7ecd41520dae
rename `stabilize` to `evolve`
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
491
diff
changeset
|
782 """Add a hint for "hg evolve" when troubles make push fails |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
783 """ |
1122
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
784 try: |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
785 return orig(repo, *args, **opts) |
1547
425c0700aabd
check-code: make evolve.py comply with check-code
Laurent Charignon <lcharignon@fb.com>
parents:
1536
diff
changeset
|
786 except error.Abort as ex: |
1122
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
787 hint = _("use 'hg evolve' to get a stable history " |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
788 "or --force to ignore warnings") |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
789 if (len(ex.args) >= 1 |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
790 and ex.args[0].startswith('push includes ') |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
791 and ex.hint is None): |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
792 ex.hint = hint |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
793 raise |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
794 |
788
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
795 def summaryhook(ui, repo): |
3457
82e9f9603b1b
evolvestate: rename the file to state.py and class name to cmdstate
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3456
diff
changeset
|
796 evolvestate = state.cmdstate(repo) |
82e9f9603b1b
evolvestate: rename the file to state.py and class name to cmdstate
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3456
diff
changeset
|
797 if evolvestate: |
1640 | 798 # i18n: column positioning for "hg summary" |
3198
390c87f8c65d
summaryhook: respect -q flag
Martin von Zweigbergk <martinvonz@google.com>
parents:
3197
diff
changeset
|
799 ui.status(_('evolve: (evolve --continue)\n')) |
788
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
800 |
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
801 @eh.extsetup |
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
802 def obssummarysetup(ui): |
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
803 cmdutil.summaryhooks.add('evolve', summaryhook) |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
804 |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
805 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
806 ### Old Evolve extension content ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
807 ##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
808 |
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
809 ### new command |
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
810 ############################# |
716
4c0f6d555032
prune: add --user and --date options
Levi Bard <levi@unity3d.com>
parents:
715
diff
changeset
|
811 |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
812 @eh.uisetup |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
813 def _installimportobsolete(ui): |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
814 entry = cmdutil.findcmd('import', commands.table)[1] |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
815 entry[1].append(('', 'obsolete', False, |
1162
5c07f464981e
help: fix typo in help for 'obsolete' option added to import command
Mike Edgar <adgar@google.com>
parents:
1160
diff
changeset
|
816 _('mark the old node as obsoleted by ' |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
817 'the created commit'))) |
930
cac35bef8aee
import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
927
diff
changeset
|
818 |
3672
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
819 def _getnodefrompatch(patch, dest): |
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
820 patchnode = patch.get('nodeid') |
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
821 if patchnode is not None: |
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
822 dest['node'] = node.bin(patchnode) |
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
823 |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
824 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
825 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): |
3671
c82f0d5740b4
import: use a less direct approach to store the expected node
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3662
diff
changeset
|
826 expected = {'node': None} |
3673
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
827 if not util.safehasattr(hunk, 'get'): # hg < 4.6 |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
828 oldextract = patch.extract |
3672
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
829 |
3673
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
830 def extract(*args, **kwargs): |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
831 ret = oldextract(*args, **kwargs) |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
832 _getnodefrompatch(ret, expected) |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
833 return ret |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
834 try: |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
835 patch.extract = extract |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
836 ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs) |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
837 finally: |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
838 patch.extract = oldextract |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
839 else: |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
840 _getnodefrompatch(hunk, expected) |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
841 ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs) |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
842 created = ret[1] |
3671
c82f0d5740b4
import: use a less direct approach to store the expected node
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3662
diff
changeset
|
843 if (opts['obsolete'] and None not in (created, expected['node']) |
c82f0d5740b4
import: use a less direct approach to store the expected node
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3662
diff
changeset
|
844 and created != expected['node']): |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
845 tr = repo.transaction('import-obs') |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
846 try: |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
847 metadata = {'user': ui.username()} |
3671
c82f0d5740b4
import: use a less direct approach to store the expected node
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3662
diff
changeset
|
848 repo.obsstore.create(tr, expected['node'], (created,), |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
849 metadata=metadata) |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
850 tr.close() |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
851 finally: |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
852 tr.release() |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
853 return ret |
930
cac35bef8aee
import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
927
diff
changeset
|
854 |
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
855 |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
856 def _deprecatealias(oldalias, newalias): |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
857 '''Deprecates an alias for a command in favour of another |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
858 |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
859 Creates a new entry in the command table for the old alias. It creates a |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
860 wrapper that has its synopsis set to show that is has been deprecated. |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
861 The documentation will be replace with a pointer to the new alias. |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
862 If a user invokes the command a deprecation warning will be printed and |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
863 the command of the *new* alias will be invoked. |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
864 |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
865 This function is loosely based on the extensions.wrapcommand function. |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
866 ''' |
1226
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
867 try: |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
868 aliases, entry = cmdutil.findcmd(newalias, cmdtable) |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
869 except error.UnknownCommand: |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
870 # Commands may be disabled |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
871 return |
1680
7caa5f2040c5
py3: use items() instead of iteritems()
timeless@gmail.com
parents:
1679
diff
changeset
|
872 for alias, e in cmdtable.items(): |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
873 if e is entry: |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
874 break |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
875 |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
876 synopsis = '(DEPRECATED)' |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
877 if len(entry) > 2: |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
878 fn, opts, _syn = entry |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
879 else: |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
880 fn, opts, = entry |
1496 | 881 deprecationwarning = _('%s have been deprecated in favor of %s\n') % ( |
882 oldalias, newalias) | |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
883 |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
884 def newfn(*args, **kwargs): |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
885 ui = args[0] |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
886 ui.warn(deprecationwarning) |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
887 util.checksignature(fn)(*args, **kwargs) |
2952
f1bbc536602a
gup/gdown: properly mark these commands as deprecated
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2925
diff
changeset
|
888 newfn.__doc__ = deprecationwarning + ' (DEPRECATED)' |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
889 cmdwrapper = eh.command(oldalias, opts, synopsis) |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
890 cmdwrapper(newfn) |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
891 |
895
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
892 @eh.extsetup |
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
893 def deprecatealiases(ui): |
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
894 _deprecatealias('gup', 'next') |
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
895 _deprecatealias('gdown', 'previous') |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
896 |
2745
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
897 def _gettopic(ctx): |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
898 """handle topic fetching with or without the extension""" |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
899 return getattr(ctx, 'topic', lambda: '')() |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
900 |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
901 def _gettopicidx(ctx): |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
902 """handle topic fetching with or without the extension""" |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
903 return getattr(ctx, 'topicidx', lambda: None)() |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
904 |
2742
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
905 def _getcurrenttopic(repo): |
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
906 return getattr(repo, 'currenttopic', '') |
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
907 |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
908 def _prevupdate(repo, displayer, target, bookmark, dryrun, mergeopt): |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
909 if dryrun: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
910 repo.ui.write(_('hg update %s;\n') % target) |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
911 if bookmark is not None: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
912 repo.ui.write(_('hg bookmark %s -r %s;\n') |
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
913 % (bookmark, target)) |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
914 else: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
915 updatecheck = None |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
916 # --merge is passed, we don't need to care about commands.update.check |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
917 # config option |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
918 if mergeopt: |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
919 updatecheck = 'none' |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
920 try: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
921 ret = hg.updatetotally(repo.ui, repo, target.node(), None, |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
922 updatecheck=updatecheck) |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
923 except error.Abort as exc: |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
924 # replace the hint to mention about --merge option |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
925 exc.hint = _('do you want --merge?') |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
926 raise |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
927 if not ret: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
928 tr = lock = None |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
929 try: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
930 lock = repo.lock() |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
931 tr = repo.transaction('previous') |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
932 if bookmark is not None: |
2752
4457aa1d81aa
compat: add a compatibility layer for bookmark move
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2748
diff
changeset
|
933 bmchanges = [(bookmark, target.node())] |
3699
67d6cc7e0979
compat: drop compatibility layer for bookmark.applychanges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3694
diff
changeset
|
934 repo._bookmarks.applychanges(repo, tr, bmchanges) |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
935 else: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
936 bookmarksmod.deactivate(repo) |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
937 tr.close() |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
938 finally: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
939 lockmod.release(tr, lock) |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
940 |
3196
94e5235e95f5
evolve: make prev/next respect --quiet flag (issue5742)
Martin von Zweigbergk <martinvonz@google.com>
parents:
3185
diff
changeset
|
941 if not repo.ui.quiet: |
94e5235e95f5
evolve: make prev/next respect --quiet flag (issue5742)
Martin von Zweigbergk <martinvonz@google.com>
parents:
3185
diff
changeset
|
942 displayer.show(target) |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
943 |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
944 def _findprevtarget(repo, displayer, movebookmark=False, topic=True): |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
945 target = bookmark = None |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
946 wkctx = repo[None] |
2741
51d669b16fa8
prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2739
diff
changeset
|
947 p1 = wkctx.parents()[0] |
51d669b16fa8
prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2739
diff
changeset
|
948 parents = p1.parents() |
2742
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
949 currenttopic = _getcurrenttopic(repo) |
2745
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
950 |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
951 # we do not filter in the 1 case to allow prev to t0 |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
952 if currenttopic and topic and _gettopicidx(p1) != 1: |
3468
a3052824101d
evolve: move builddependencies() and _singlesuccessor() to utility module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3467
diff
changeset
|
953 parents = [repo[utility._singlesuccessor(repo, ctx)] if ctx.mutable() else ctx |
3362
92b414710d2e
prev: jump to parent's successor if parent is obsolete and topic is involved
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3232
diff
changeset
|
954 for ctx in parents] |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
955 parents = [ctx for ctx in parents if ctx.topic() == currenttopic] |
2741
51d669b16fa8
prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2739
diff
changeset
|
956 |
51d669b16fa8
prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2739
diff
changeset
|
957 # issue message for the various case |
51d669b16fa8
prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2739
diff
changeset
|
958 if p1.node() == node.nullid: |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
959 repo.ui.warn(_('already at repository root\n')) |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
960 elif not parents and currenttopic: |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
961 repo.ui.warn(_('no parent in topic "%s"\n') % currenttopic) |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
962 repo.ui.warn(_('(do you want --no-topic)\n')) |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
963 elif len(parents) == 1: |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
964 target = parents[0] |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
965 bookmark = None |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
966 if movebookmark: |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
967 bookmark = repo._activebookmark |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
968 else: |
3551
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
969 header = _("multiple parents, choose one to update:") |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
970 prevs = [p.rev() for p in parents] |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
971 choosedrev = utility.revselectionprompt(repo.ui, repo, prevs, header) |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
972 if choosedrev is None: |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
973 for p in parents: |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
974 displayer.show(p) |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
975 repo.ui.warn(_('multiple parents, explicitly update to one\n')) |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
976 else: |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
977 target = repo[choosedrev] |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
978 return target, bookmark |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
979 |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
980 @eh.command( |
4184
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
981 'previous', |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
982 [('B', 'move-bookmark', False, |
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
983 _('move active bookmark after update')), |
3574
8aba29d8b133
previous/next: add -m short form for --merge
Martin von Zweigbergk <martinvonz@google.com>
parents:
3561
diff
changeset
|
984 ('m', 'merge', False, _('bring uncommitted change along')), |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
985 ('', 'no-topic', False, _('ignore topic and move topologically')), |
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
986 ('n', 'dry-run', False, |
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
987 _('do not perform actions, just print what would be done'))], |
4184
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
988 '[OPTION]...', |
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
989 helpbasic=True) |
1160
e29a813f6af5
Make next/prev only move bookmarks optionally
Ryan McElroy <rmcelroy@fb.com>
parents:
1157
diff
changeset
|
990 def cmdprevious(ui, repo, **opts): |
1572
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
991 """update to parent revision |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
992 |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
993 Displays the summary line of the destination for clarity.""" |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
994 wlock = None |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
995 dryrunopt = opts['dry_run'] |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
996 mergeopt = opts['merge'] |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
997 if not dryrunopt: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
998 wlock = repo.wlock() |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
999 try: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1000 wkctx = repo[None] |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1001 wparents = wkctx.parents() |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1002 if len(wparents) != 1: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1003 raise error.Abort(_('merge in progress')) |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1004 if not mergeopt: |
3781
e73a73b27f3e
prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3779
diff
changeset
|
1005 # we only skip the check if noconflict is set |
e73a73b27f3e
prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3779
diff
changeset
|
1006 if ui.config('commands', 'update.check') == 'noconflict': |
e73a73b27f3e
prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3779
diff
changeset
|
1007 pass |
e73a73b27f3e
prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3779
diff
changeset
|
1008 else: |
4238
18648e1aded0
prev: use the `hint` argument of bail if changed
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4236
diff
changeset
|
1009 cmdutil.bailifchanged(repo, hint=_('do you want --merge?')) |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1010 |
2743
2fe562f94ead
prev: retrieve the 'no-topic' result is a clear and reusable option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2742
diff
changeset
|
1011 topic = not opts.get("no_topic", False) |
4161
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1012 hastopic = bool(_getcurrenttopic(repo)) |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1013 |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1014 template = shorttemplate |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1015 if topic and hastopic: |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1016 template = utility.stacktemplate |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1017 |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1018 displayer = compat.changesetdisplayer(ui, repo, {'template': template}) |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
1019 |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
1020 target, bookmark = _findprevtarget(repo, displayer, |
2743
2fe562f94ead
prev: retrieve the 'no-topic' result is a clear and reusable option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2742
diff
changeset
|
1021 opts.get('move_bookmark'), topic) |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
1022 if target is not None: |
2795
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1023 backup = repo.ui.backupconfig('_internal', 'keep-topic') |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1024 try: |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1025 if topic and _getcurrenttopic(repo) != _gettopic(target): |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1026 repo.ui.setconfig('_internal', 'keep-topic', 'yes', |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1027 source='topic-extension') |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1028 _prevupdate(repo, displayer, target, bookmark, dryrunopt, |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1029 mergeopt) |
2795
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1030 finally: |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1031 repo.ui.restoreconfig(backup) |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
1032 return 0 |
1500 | 1033 else: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1034 return 1 |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1035 finally: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1036 lockmod.release(wlock) |
127
7e113963f2c8
Add gup and gdown command to mimic qpop and qpush command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
119
diff
changeset
|
1037 |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1038 @eh.command( |
4184
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
1039 'next', |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1040 [('B', 'move-bookmark', False, |
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1041 _('move active bookmark after update')), |
3574
8aba29d8b133
previous/next: add -m short form for --merge
Martin von Zweigbergk <martinvonz@google.com>
parents:
3561
diff
changeset
|
1042 ('m', 'merge', False, _('bring uncommitted change along')), |
4247
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1043 ('', 'evolve', True, _('evolve the next changeset if necessary')), |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1044 ('', 'no-topic', False, _('ignore topic and move topologically')), |
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1045 ('n', 'dry-run', False, |
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1046 _('do not perform actions, just print what would be done'))], |
4184
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
1047 '[OPTION]...', |
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
1048 helpbasic=True) |
1160
e29a813f6af5
Make next/prev only move bookmarks optionally
Ryan McElroy <rmcelroy@fb.com>
parents:
1157
diff
changeset
|
1049 def cmdnext(ui, repo, **opts): |
1572
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1050 """update to next child revision |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1051 |
4248
51b69f3dfc0b
next: update the command description
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4247
diff
changeset
|
1052 If necessary, evolve the next changeset. Use --no-evolve to disable this |
51b69f3dfc0b
next: update the command description
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4247
diff
changeset
|
1053 behavior. |
1572
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1054 |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1055 Displays the summary line of the destination for clarity. |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1056 """ |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1057 wlock = None |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1058 dryrunopt = opts['dry_run'] |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1059 if not dryrunopt: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1060 wlock = repo.wlock() |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1061 try: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1062 wkctx = repo[None] |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1063 wparents = wkctx.parents() |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1064 if len(wparents) != 1: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1065 raise error.Abort(_('merge in progress')) |
3779
084038b98cd7
next: bail out early in `hg next --evolve` if dirty wdir
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3743
diff
changeset
|
1066 |
4233
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1067 children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()] |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1068 topic = _getcurrenttopic(repo) |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1069 filtered = set() |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1070 template = shorttemplate |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1071 if topic and not opts.get("no_topic", False): |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1072 filtered = set(ctx for ctx in children if ctx.topic() != topic) |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1073 children = [ctx for ctx in children if ctx not in filtered] |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1074 template = utility.stacktemplate |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1075 displayer = compat.changesetdisplayer(ui, repo, {'template': template}) |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1076 |
4234
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1077 # check if we need to evolve while updating to the next child revision |
4247
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1078 needevolve = False |
4234
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1079 aspchildren = evolvecmd._aspiringchildren(repo, [repo['.'].rev()]) |
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1080 if topic: |
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1081 filtered.update(repo[c] for c in aspchildren |
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1082 if repo[c].topic() != topic) |
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1083 aspchildren = [ctx for ctx in aspchildren if ctx not in filtered] |
4252
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1084 |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1085 # To catch and prevent the case when `next` would get confused by split, |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1086 # lets filter those aspiring children which can be stablized on one of |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1087 # the aspiring children itself. |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1088 aspirants = set(aspchildren) |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1089 for aspchild in aspchildren: |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1090 possdests = evolvecmd._possibledestination(repo, aspchild) |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1091 if possdests & aspirants: |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1092 filtered.add(aspchild) |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1093 aspchildren = [ctx for ctx in aspchildren if ctx not in filtered] |
4247
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1094 if aspchildren: |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1095 needevolve = True |
4234
2cc81ae30f37
next: set if we need to evolve or not; also move logic to appropriate pos
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4233
diff
changeset
|
1096 |
4247
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1097 # check if working directory is clean before we evolve the next cset |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1098 if needevolve and opts['evolve']: |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1099 hint = _('use `hg amend`, `hg revert` or `hg shelve`') |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1100 cmdutil.bailifchanged(repo, hint=hint) |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1101 |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1102 if not (opts['merge'] or (needevolve and opts['evolve'])): |
3782
27cf636b2f4d
next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3781
diff
changeset
|
1103 # we only skip the check if noconflict is set |
27cf636b2f4d
next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3781
diff
changeset
|
1104 if ui.config('commands', 'update.check') == 'noconflict': |
27cf636b2f4d
next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3781
diff
changeset
|
1105 pass |
27cf636b2f4d
next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3781
diff
changeset
|
1106 else: |
4239
7e274734cc2c
next: use the `hint` argument of bail if changed
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4238
diff
changeset
|
1107 cmdutil.bailifchanged(repo, hint=_('do you want --merge?')) |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1108 |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1109 if len(children) == 1: |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1110 c = children[0] |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1111 return _updatetonext(ui, repo, c, displayer, opts) |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1112 elif children: |
3547
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1113 cheader = _("ambiguous next changeset, choose one to update:") |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1114 crevs = [c.rev() for c in children] |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1115 choosedrev = utility.revselectionprompt(ui, repo, crevs, cheader) |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1116 if choosedrev is None: |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1117 ui.warn(_("ambiguous next changeset:\n")) |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1118 for c in children: |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1119 displayer.show(c) |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1120 ui.warn(_("explicitly update to one of them\n")) |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1121 return 1 |
3547
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1122 else: |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1123 return _updatetonext(ui, repo, repo[choosedrev], displayer, opts) |
1500 | 1124 else: |
4242
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1125 if not opts['evolve'] or not aspchildren: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1126 if filtered: |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1127 ui.warn(_('no children on topic "%s"\n') % topic) |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1128 ui.warn(_('do you want --no-topic\n')) |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1129 else: |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1130 ui.warn(_('no children\n')) |
4242
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1131 if aspchildren: |
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1132 msg = _('(%i unstable changesets to be evolved here, ' |
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1133 'do you want --evolve?)\n') |
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1134 ui.warn(msg % len(aspchildren)) |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1135 return 1 |
4250
781d058d14f9
cleanup: avoid a Yoda condition
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4248
diff
changeset
|
1136 elif len(aspchildren) > 1: |
3549
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1137 cheader = _("ambiguous next (unstable) changeset, choose one to" |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1138 " evolve and update:") |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1139 choosedrev = utility.revselectionprompt(ui, repo, |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1140 aspchildren, cheader) |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1141 if choosedrev is None: |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1142 ui.warn(_("ambiguous next (unstable) changeset:\n")) |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1143 for c in aspchildren: |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1144 displayer.show(repo[c]) |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1145 ui.warn(_("(run 'hg evolve --rev REV' on one of them)\n")) |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1146 return 1 |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1147 else: |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1148 return _nextevolve(ui, repo, repo[choosedrev], opts) |
1628
db19b1dc5c45
topic: restrict 'hg prev' to current topic unless --no-topic is passed
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1627
diff
changeset
|
1149 else: |
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1150 return _nextevolve(ui, repo, aspchildren[0], opts) |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1151 finally: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1152 lockmod.release(wlock) |
87
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
82
diff
changeset
|
1153 |
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1154 def _nextevolve(ui, repo, aspchildren, opts): |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1155 """logic for hg next command to evolve and update to an aspiring children""" |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1156 |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1157 cmdutil.bailifchanged(repo) |
3653
d9682c41ea2f
evolve: restore bookmarks correctly after `hg evolve --abort`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3641
diff
changeset
|
1158 evolvestate = state.cmdstate(repo, opts={'command': 'next', |
d9682c41ea2f
evolve: restore bookmarks correctly after `hg evolve --abort`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3641
diff
changeset
|
1159 'bookmarkchanges': []}) |
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1160 result = evolvecmd._solveone(ui, repo, repo[aspchildren], |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1161 evolvestate, opts.get('dry_run'), False, |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1162 lambda: None, category='orphan') |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1163 # making sure a next commit is formed |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1164 if result[0] and result[1]: |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1165 ui.status(_('working directory now at %s\n') |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1166 % ui.label(str(repo['.']), 'evolve.node')) |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1167 return 0 |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1168 |
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1169 def _updatetonext(ui, repo, children, displayer, opts): |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1170 """ logic for `hg next` command to update to children and move bookmarks if |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1171 required """ |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1172 bm = repo._activebookmark |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1173 shouldmove = opts.get('move_bookmark') and bm is not None |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1174 if opts.get('dry_run'): |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1175 ui.write(_('hg update %s;\n') % children) |
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1176 if shouldmove: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1177 ui.write(_('hg bookmark %s -r %s;\n') % (bm, children)) |
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1178 else: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1179 updatecheck = None |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1180 # --merge is passed, we don't need to care about commands.update.check |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1181 # config option |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1182 if opts['merge']: |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1183 updatecheck = 'none' |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1184 try: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1185 ret = hg.updatetotally(ui, repo, children.node(), None, |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1186 updatecheck=updatecheck) |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1187 except error.Abort as exc: |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1188 # replace the hint to mention about --merge option |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1189 exc.hint = _('do you want --merge?') |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1190 raise |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1191 |
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1192 if not ret: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1193 lock = tr = None |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1194 try: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1195 lock = repo.lock() |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1196 tr = repo.transaction('next') |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1197 if shouldmove: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1198 bmchanges = [(bm, children.node())] |
3699
67d6cc7e0979
compat: drop compatibility layer for bookmark.applychanges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3694
diff
changeset
|
1199 repo._bookmarks.applychanges(repo, tr, bmchanges) |
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1200 else: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1201 bookmarksmod.deactivate(repo) |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1202 tr.close() |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1203 finally: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1204 lockmod.release(tr, lock) |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1205 if not ui.quiet: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1206 displayer.show(children) |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1207 return 0 |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1208 |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1209 @eh.wrapcommand('commit') |
116
64ca29eef349
Add a -o option to commit
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
113
diff
changeset
|
1210 def commitwrapper(orig, ui, repo, *arg, **kwargs): |
1558
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1211 tr = None |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1212 if kwargs.get('amend', False): |
1255
a2d4901e211e
commit: avoid potential deadlock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1253
diff
changeset
|
1213 wlock = lock = None |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1214 else: |
1255
a2d4901e211e
commit: avoid potential deadlock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1253
diff
changeset
|
1215 wlock = repo.wlock() |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1216 lock = repo.lock() |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1217 try: |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1218 obsoleted = kwargs.get('obsolete', []) |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1219 if obsoleted: |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1220 obsoleted = repo.set('%lr', obsoleted) |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1221 result = orig(ui, repo, *arg, **kwargs) |
1659 | 1222 if not result: # commit succeeded |
3662
0caa27259800
evolve: don't pass stringified int to repo.__getitem__
Martin von Zweigbergk <martinvonz@google.com>
parents:
3653
diff
changeset
|
1223 new = repo['tip'] |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1224 oldbookmarks = [] |
444
aedb6b8ace86
drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
443
diff
changeset
|
1225 markers = [] |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1226 for old in obsoleted: |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1227 oldbookmarks.extend(repo.nodebookmarks(old.node())) |
444
aedb6b8ace86
drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
443
diff
changeset
|
1228 markers.append((old, (new,))) |
aedb6b8ace86
drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
443
diff
changeset
|
1229 if markers: |
3694
c0d5e0929f8b
compat: from compatibility layer for createmarkers
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3691
diff
changeset
|
1230 obsolete.createmarkers(repo, markers, operation="amend") |
2752
4457aa1d81aa
compat: add a compatibility layer for bookmark move
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2748
diff
changeset
|
1231 bmchanges = [] |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1232 for book in oldbookmarks: |
2752
4457aa1d81aa
compat: add a compatibility layer for bookmark move
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2748
diff
changeset
|
1233 bmchanges.append((book, new.node())) |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1234 if oldbookmarks: |
1558
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1235 if not wlock: |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1236 wlock = repo.wlock() |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1237 if not lock: |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1238 lock = repo.lock() |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1239 tr = repo.transaction('commit') |
3699
67d6cc7e0979
compat: drop compatibility layer for bookmark.applychanges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3694
diff
changeset
|
1240 repo._bookmarks.applychanges(repo, tr, bmchanges) |
1558
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1241 tr.close() |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1242 return result |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1243 finally: |
1558
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1244 lockmod.release(tr, lock, wlock) |
116
64ca29eef349
Add a -o option to commit
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
113
diff
changeset
|
1245 |
1220
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1246 @eh.wrapcommand('strip', extension='strip', opts=[ |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1247 ('', 'bundle', None, _("delete the commit entirely and move it to a " |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
1248 "backup bundle")), |
1220
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1249 ]) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1250 def stripwrapper(orig, ui, repo, *revs, **kwargs): |
4324
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
1251 if (not ui.configbool('experimental', 'prunestrip') |
4235
e30119dfd626
style: fix various flake8 warning
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4184
diff
changeset
|
1252 or kwargs.get('bundle', False)): |
1220
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1253 return orig(ui, repo, *revs, **kwargs) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1254 |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1255 if kwargs.get('force'): |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1256 ui.warn(_("warning: --force has no effect during strip with evolve " |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1257 "enabled\n")) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1258 if kwargs.get('no_backup', False): |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1259 ui.warn(_("warning: --no-backup has no effect during strips with " |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1260 "evolve enabled\n")) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1261 |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1262 revs = list(revs) + kwargs.pop('rev', []) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1263 revs = set(scmutil.revrange(repo, revs)) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1264 revs = repo.revs("(%ld)::", revs) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1265 kwargs['rev'] = [] |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1266 kwargs['new'] = [] |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1267 kwargs['succ'] = [] |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1268 kwargs['biject'] = False |
2772
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
1269 return cmdrewrite.cmdprune(ui, repo, *revs, **kwargs) |
1220
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1270 |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1271 @eh.extsetup |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1272 def oldevolveextsetup(ui): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1273 entry = cmdutil.findcmd('commit', commands.table)[1] |
303 | 1274 entry[1].append(('o', 'obsolete', [], |
1008
a010ba5a0ffb
evolve: deprecated --obsolete and --old-obsolete option on commit and graft
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1007
diff
changeset
|
1275 _("make commit obsolete this revision (DEPRECATED)"))) |
211
69a37d56c7fb
evolve: issue the "%i new unstable changeset" in more place
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
196
diff
changeset
|
1276 |
1302
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1277 @eh.wrapfunction(obsolete, '_checkinvalidmarkers') |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1278 def _checkinvalidmarkers(orig, markers): |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1279 """search for marker with invalid data and raise error if needed |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1280 |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1281 Exist as a separated function to allow the evolve extension for a more |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1282 subtle handling. |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1283 """ |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1284 if 'debugobsconvert' in sys.argv: |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1285 return |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1286 for mark in markers: |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1287 if node.nullid in mark[1]: |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
1288 msg = _('bad obsolescence marker detected: invalid successors nullid') |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
1289 hint = _('You should run `hg debugobsconvert`') |
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
1290 raise error.Abort(msg, hint=hint) |
1202
4099b087f672
evolve: handle invalid obsmarkers in the `debugobsconvert`
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1198
diff
changeset
|
1291 |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1292 @eh.command( |
1159
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1293 'debugobsconvert', |
2053
f3765c4a352a
exchange: rename the module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2051
diff
changeset
|
1294 [('', 'new-format', obsexchange._bestformat, _('Destination format for markers.'))], |
1159
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1295 '') |
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1296 def debugobsconvert(ui, repo, new_format): |
1507
6f574c76c142
debugobsconvert: make sure obsstore is loaded before version comparison
Yuya Nishihara <yuya@tcha.org>
parents:
1506
diff
changeset
|
1297 origmarkers = repo.obsstore._all # settle version |
1159
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1298 if new_format == repo.obsstore._version: |
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1299 msg = _('New format is the same as the old format, not upgrading!') |
1547
425c0700aabd
check-code: make evolve.py comply with check-code
Laurent Charignon <lcharignon@fb.com>
parents:
1536
diff
changeset
|
1300 raise error.Abort(msg) |
2748
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1301 with repo.lock(): |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1302 f = repo.svfs('obsstore', 'wb', atomictemp=True) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1303 known = set() |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1304 markers = [] |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1305 for m in origmarkers: |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1306 # filter out invalid markers |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1307 if nullid in m[1]: |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1308 m = list(m) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1309 m[1] = tuple(s for s in m[1] if s != nullid) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1310 m = tuple(m) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1311 if m in known: |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1312 continue |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1313 known.add(m) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1314 markers.append(m) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1315 ui.write(_('Old store is version %d, will rewrite in version %d\n') % ( |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1316 repo.obsstore._version, new_format)) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1317 map(f.write, obsolete.encodemarkers(markers, True, new_format)) |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1318 f.close() |
1159
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1319 ui.write(_('Done!\n')) |
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1320 |
864
401da1b38cca
discovery: implement a discovery process and use it for push
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
863
diff
changeset
|
1321 |
1827
15ec53d46f44
compat: drop handling of ancestral 'helploader' caller
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1826
diff
changeset
|
1322 def _helploader(ui): |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1323 return help.gettext(evolutionhelptext) |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1324 |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1325 @eh.uisetup |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1326 def _setuphelp(ui): |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1327 for entry in help.helptable: |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1328 if entry[0] == "evolution": |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1329 break |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1330 else: |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1331 help.helptable.append((["evolution"], _("Safely Rewriting History"), |
2032
dd7e092a854a
flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2024
diff
changeset
|
1332 _helploader)) |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1333 help.helptable.sort() |
1567
536fdfa3c48b
evolve: extract logic to new method _relocatecommit
Shusen LIU <liushusen@fb.com>
parents:
1566
diff
changeset
|
1334 |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1335 evolvestateversion = 0 |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1336 |
3839
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1337 def _evolvemessage(): |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1338 _msg = _('To continue: hg evolve --continue\n' |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1339 'To abort: hg evolve --abort\n' |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1340 'To stop: hg evolve --stop\n' |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1341 '(also see `hg help evolve.interrupted`)') |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1342 return cmdutil._commentlines(_msg) |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1343 |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1344 @eh.uisetup |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1345 def setupevolveunfinished(ui): |
3641
ed50f10aacbd
evolve: don't allow updating or commiting when there is interrupted evolve
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3615
diff
changeset
|
1346 data = ('evolvestate', False, False, _('evolve in progress'), |
3743
648552969e88
evolve: point to '--abort' in verbose status message
Martin von Zweigbergk <martinvonz@google.com>
parents:
3705
diff
changeset
|
1347 _("use 'hg evolve --continue' or 'hg evolve --abort' to abort")) |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1348 cmdutil.unfinishedstates.append(data) |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1349 |
3472
05bd493d496d
evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3470
diff
changeset
|
1350 afterresolved = ('evolvestate', _('hg evolve --continue')) |
4054
46cd437fd3d2
pick: fix last references of grab in code
Boris Feld <boris.feld@octobus.net>
parents:
4052
diff
changeset
|
1351 pickresolved = ('pickstate', _('hg pick --continue')) |
3472
05bd493d496d
evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3470
diff
changeset
|
1352 cmdutil.afterresolvedstates.append(afterresolved) |
4054
46cd437fd3d2
pick: fix last references of grab in code
Boris Feld <boris.feld@octobus.net>
parents:
4052
diff
changeset
|
1353 cmdutil.afterresolvedstates.append(pickresolved) |
3472
05bd493d496d
evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3470
diff
changeset
|
1354 |
3926
35172bd95e57
compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3870
diff
changeset
|
1355 if util.safehasattr(cmdutil, 'STATES'): |
35172bd95e57
compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3870
diff
changeset
|
1356 statedata = ('evolve', cmdutil.fileexistspredicate('evolvestate'), |
35172bd95e57
compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3870
diff
changeset
|
1357 _evolvemessage) |
35172bd95e57
compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3870
diff
changeset
|
1358 cmdutil.STATES = (statedata, ) + cmdutil.STATES |
3839
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1359 |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1360 @eh.wrapfunction(hg, 'clean') |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1361 def clean(orig, repo, *args, **kwargs): |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1362 ret = orig(repo, *args, **kwargs) |
2070
9105c3c54045
cleanup: stop using 'repo.join' methods
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2064
diff
changeset
|
1363 util.unlinkpath(repo.vfs.join('evolvestate'), ignoremissing=True) |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1364 return ret |