author | Anton Shestakov <av6@dwimlabs.net> |
Sat, 22 Jun 2019 18:37:21 +0800 | |
branch | stable |
changeset 4698 | b89495215c6e |
parent 4692 | a9cf0ba6e6c7 |
child 4706 | de194ed973ba |
child 4763 | 184c64c81528 |
permissions | -rw-r--r-- |
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 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
54 |
Obsolescence Markers Discovery |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
55 |
============================== |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
56 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
57 |
The evolve extension containts an experimental new protocol to discover common |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
58 |
markers between local and remote repositories. |
2550
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
59 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
60 |
"Large" repositories (hundreds of thousands) will take some time to warm the |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
61 |
necessary cache. Some key algorithm has a naive implementation that can result |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
62 |
in large memory or CPU Load. |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
63 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
64 |
The following config controls the new protocol:: |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
65 |
|
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
66 |
[experimental] |
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 |
# enable new discovery protocol |
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
69 |
# default to "yes" |
2460
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
70 |
obshashrange = yes |
64cc0b059073
obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2443
diff
changeset
|
71 |
|
3368
7310f3ef6dee
caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3365
diff
changeset
|
72 |
# control cache warming at the end of transaction |
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
73 |
# yes: warm all caches at the end of each transaction |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
74 |
# (recommended for server), |
3368
7310f3ef6dee
caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3365
diff
changeset
|
75 |
# off: warm no caches at the end of transaction, |
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
76 |
# (no cache overhead during transaction, |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
77 |
# but cache will be warm from scratch on usage) |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
78 |
# auto: warm cache at the end of server side transaction(ie: push) |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
79 |
# (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 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
82 |
When you switch to using this protocol, we recommand that you explicitly warm |
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
83 |
cache for your server side repositories.:: |
2715
61e73c8fe169
obshashrange: add cache warming instruction to the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2714
diff
changeset
|
84 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
85 |
$ hg debugupdatecache |
2715
61e73c8fe169
obshashrange: add cache warming instruction to the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2714
diff
changeset
|
86 |
|
2678
da2b3e5e4f69
docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents:
2667
diff
changeset
|
87 |
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
|
88 |
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
|
89 |
|
84982b441e82
documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2465
diff
changeset
|
90 |
[extensions] |
84982b441e82
documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2465
diff
changeset
|
91 |
blackbox = |
2493
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
92 |
|
2550
d8a48234efad
obshashrange: basic proof reading of the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2549
diff
changeset
|
93 |
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
|
94 |
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
|
95 |
|
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 |
[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
|
97 |
# 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
|
98 |
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
|
99 |
|
2551
ecd47c63b6de
obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2550
diff
changeset
|
100 |
# 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
|
101 |
# 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
|
102 |
# 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
|
103 |
# 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
|
104 |
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
|
105 |
|
4664
a3f9f8d3bde5
doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4644
diff
changeset
|
106 |
For very large repositories, it might be useful to disable obsmarkers |
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 |
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
|
108 |
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
|
109 |
|
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
110 |
[experimental] |
7eff426f999b
evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2699
diff
changeset
|
111 |
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
|
112 |
|
2493
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
113 |
Effect Flag Experiment |
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
114 |
====================== |
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
115 |
|
2689
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
116 |
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
|
117 |
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
|
118 |
an obsolete changeset and its tipmost successors. |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
119 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
120 |
Evolve currently records: |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
121 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
122 |
- Meta changes, user, date |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
123 |
- 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
|
124 |
- Description, was the commit description edited |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
125 |
- 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
|
126 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
127 |
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
|
128 |
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
|
129 |
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
|
130 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
131 |
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
|
132 |
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
|
133 |
the effect flag attached. |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
134 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
135 |
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
|
136 |
|
3ee8e9a12f41
doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents:
2488
diff
changeset
|
137 |
[experimental] |
2689
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
138 |
# 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
|
139 |
# evolution.effect-flags = false |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
140 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
141 |
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
|
142 |
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
|
143 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
144 |
$ hg commit -m "WIP |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
145 |
$ hg commit -m "A better commit message!" |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
146 |
$ hg obslog . |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
147 |
@ 8e9045855628 (3133) A better commit message! |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
148 |
| |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
149 |
x 7863a5bb5763 (3132) WIP |
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
150 |
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
|
151 |
|
9e84b407fde5
doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents:
2687
diff
changeset
|
152 |
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
|
153 |
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
|
154 |
the effect flag recording. |
2556
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
155 |
|
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
156 |
Templates |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
157 |
========= |
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 |
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
|
160 |
about your obs history: |
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
161 |
|
d5b97b5dec5b
doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2551
diff
changeset
|
162 |
- 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
|
163 |
precursors. |
3225
28fb347a5bf8
typos: fix typos in several locations
Kyle Lippincott <spectral@google.com>
parents:
3198
diff
changeset
|
164 |
- 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
|
165 |
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
|
166 |
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
|
167 |
obslog command and the --all option. |
2591
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
168 |
- 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
|
169 |
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
|
170 |
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
|
171 |
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
|
172 |
|
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
173 |
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
|
174 |
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
|
175 |
|
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
176 |
- "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
|
177 |
- "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
|
178 |
changeset and one of its successor |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
179 |
- "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
|
180 |
changeset and one of its successor |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
181 |
- "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
|
182 |
successor |
1991935fb603
obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents:
2586
diff
changeset
|
183 |
- "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
|
184 |
- "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
|
185 |
""" |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
186 |
|
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
187 |
evolutionhelptext = """ |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
188 |
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
|
189 |
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
|
190 |
|
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
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
|
195 |
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
|
196 |
: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
|
197 |
|
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
198 |
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
|
199 |
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
|
200 |
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
|
201 |
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
|
202 |
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
|
203 |
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
|
204 |
|
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
205 |
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
|
206 |
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
|
207 |
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
|
208 |
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
|
209 |
of history concurrently. |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
210 |
|
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
211 |
Current feature status |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
212 |
====================== |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
213 |
|
1710 | 214 |
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
|
215 |
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
|
216 |
|
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
217 |
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
|
218 |
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
|
219 |
via an extension). |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
220 |
|
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
221 |
Instability |
4471
3caa4a459439
tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4464
diff
changeset
|
222 |
=========== |
2782
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
223 |
|
4471
3caa4a459439
tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4464
diff
changeset
|
224 |
Rewriting changesets might introduce instability. |
2782
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
225 |
|
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
226 |
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
|
227 |
|
4471
3caa4a459439
tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4464
diff
changeset
|
228 |
Orphans are changesets left behind when their ancestors are rewritten. |
2782
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
229 |
Divergence has two variants: |
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 |
* Content-divergence occurs when independent rewrites of the same changesets |
4471
3caa4a459439
tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4464
diff
changeset
|
232 |
lead to different results. |
2782
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 |
* Phase-divergence occurs when the old (obsolete) version of a changeset |
4471
3caa4a459439
tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4464
diff
changeset
|
235 |
becomes public. |
2782
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
236 |
|
4471
3caa4a459439
tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4464
diff
changeset
|
237 |
It is possible to prevent local creation of orphans by using the following config:: |
2782
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
238 |
|
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
239 |
[experimental] |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
240 |
evolution=createmarkers,allnewcommands,exchange |
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 |
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
|
243 |
|
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
244 |
[experimental] |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
245 |
evolution=createmarkers,allnewcommands,allowunstable,exchange |
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 |
or simply:: |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
248 |
|
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
249 |
[experimental] |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
250 |
evolution=all |
2bd0b0996cfb
evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2772
diff
changeset
|
251 |
""".strip() |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
252 |
|
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
|
253 |
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
|
254 |
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
|
255 |
|
1678 | 256 |
try: |
1825
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
257 |
from mercurial import registrar |
377d94d6c889
evolve: proactively detect bad version early
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1824
diff
changeset
|
258 |
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
|
259 |
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
|
260 |
from . import metadata |
2895
e4ee0b6170e9
compat: make it more clear that evolve need Mercurial >= minversion
Philippe Pepiot <phil@philpep.org>
parents:
2859
diff
changeset
|
261 |
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
|
262 |
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
|
263 |
|
670
97ce1f801309
evolve: drop unused import
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
663
diff
changeset
|
264 |
import mercurial |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
265 |
from mercurial import util |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
266 |
|
1834
f23a97d14895
compat: drop compat for older wireproto implementation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1833
diff
changeset
|
267 |
from mercurial import obsolete |
617
469befc27b26
detect incompatibility with future mercurial 2.5
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
616
diff
changeset
|
268 |
|
1823
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
269 |
from mercurial import ( |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
270 |
bookmarks as bookmarksmod, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
271 |
cmdutil, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
272 |
commands, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
273 |
context, |
2465
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
274 |
dirstate, |
1823
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
275 |
error, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
276 |
help, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
277 |
hg, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
278 |
lock as lockmod, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
279 |
node, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
280 |
patch, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
281 |
revset, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
282 |
scmutil, |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
283 |
) |
649d7a574c3f
evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1822
diff
changeset
|
284 |
|
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
285 |
from mercurial.i18n import _ |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
286 |
from mercurial.node import nullid |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
287 |
|
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
288 |
from . import ( |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
2524
diff
changeset
|
289 |
compat, |
2123
cf7b4ab31f0c
split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2122
diff
changeset
|
290 |
debugcmd, |
2772
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
291 |
cmdrewrite, |
3457
82e9f9603b1b
evolvestate: rename the file to state.py and class name to cmdstate
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3456
diff
changeset
|
292 |
state, |
3461
6475d2046f87
evolvecmd: introduce a new module to handle `hg evolve` related code
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3460
diff
changeset
|
293 |
evolvecmd, |
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
294 |
exthelper, |
2049
b81d3775006b
evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2048
diff
changeset
|
295 |
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
|
296 |
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
|
297 |
obsexchange, |
4644
b228672b0ff9
obshashtree: move obshashtree in its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4624
diff
changeset
|
298 |
obshashtree, |
2524
d912380ec685
evolve: fix import order
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2521
diff
changeset
|
299 |
obshistory, |
3858
bb4f5ad63877
rewind: add a proto version of the command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3839
diff
changeset
|
300 |
rewind, |
2756
f4dd6e6d4c73
rewriteutil: create a rewriteutil module to host utility function
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2755
diff
changeset
|
301 |
rewriteutil, |
2286
a4c5744a7b93
safeguard: add an option to disable automatic publishing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2275
diff
changeset
|
302 |
safeguard, |
2524
d912380ec685
evolve: fix import order
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2521
diff
changeset
|
303 |
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
|
304 |
utility, |
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
305 |
) |
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
306 |
|
3373
3ff0da45d4c7
evolve: use compat.TROUBLES to show troubles in user interface
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3369
diff
changeset
|
307 |
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
|
308 |
__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
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
|
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
|
313 |
# 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
|
314 |
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
|
315 |
|
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 |
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
|
317 |
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
|
318 |
|
2404
c07f752137f4
label: rename 'evolve.short_node' to 'evolve.node'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2403
diff
changeset
|
319 |
colortable = {'evolve.node': 'yellow', |
2337
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
320 |
'evolve.user': 'green', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
321 |
'evolve.rev': 'blue', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
322 |
'evolve.short_description': '', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
323 |
'evolve.date': 'cyan', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
324 |
'evolve.current_rev': 'bold', |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
325 |
'evolve.verb': '', |
3501
7c8150697810
color: add some colors to evolve command itself
Boris Feld <boris.feld@octobus.net>
parents:
3484
diff
changeset
|
326 |
'evolve.operation': 'bold' |
2337
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
327 |
} |
c0ed4adf965e
obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents:
2336
diff
changeset
|
328 |
|
820
a9a66143e2ec
exchange: actually use _pushkeyescape fallback
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
819
diff
changeset
|
329 |
_pack = struct.pack |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
330 |
_unpack = struct.unpack |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
331 |
|
1296
23819e1d61fd
evolve: add -i flag to amend command
Laurent Charignon <lcharignon@fb.com>
parents:
1281
diff
changeset
|
332 |
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
|
333 |
commitopts3 = cmdrewrite.commitopts3 |
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
334 |
interactiveopt = cmdrewrite.interactiveopt |
2759
3137185b1bfe
rewriteutil: move the 'rewrite' function
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2758
diff
changeset
|
335 |
rewrite = rewriteutil.rewrite |
2724
e6bc6eaa17c5
amend: extract into a 'evolve.evocommands' module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2716
diff
changeset
|
336 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
337 |
# This extension contains the following code |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
338 |
# |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
339 |
# - Extension Helper code |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
340 |
# - Obsolescence cache |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
341 |
# - ... |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
342 |
# - Older format compat |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
343 |
|
2041
3b6550261614
exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2032
diff
changeset
|
344 |
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
|
345 |
eh.merge(debugcmd.eh) |
3470
ece5cd58147d
evolve: move the evolve command to evolvecmd.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3469
diff
changeset
|
346 |
eh.merge(evolvecmd.eh) |
2053
f3765c4a352a
exchange: rename the module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2051
diff
changeset
|
347 |
eh.merge(obsexchange.eh) |
4644
b228672b0ff9
obshashtree: move obshashtree in its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4624
diff
changeset
|
348 |
eh.merge(obshashtree.eh) |
2286
a4c5744a7b93
safeguard: add an option to disable automatic publishing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2275
diff
changeset
|
349 |
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
|
350 |
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
|
351 |
eh.merge(obshistory.eh) |
2485
e6ecd35e99ec
refactor: extract templates into a new file
Boris Feld <boris.feld@octobus.net>
parents:
2481
diff
changeset
|
352 |
eh.merge(templatekw.eh) |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
2524
diff
changeset
|
353 |
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
|
354 |
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
|
355 |
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
|
356 |
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
|
357 |
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
|
358 |
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
|
359 |
cmdtable = eh.cmdtable |
3080
461c9d940519
evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents:
3074
diff
changeset
|
360 |
configtable = eh.configtable |
4328
392f1a6a0763
exthelper: simplify the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents:
4324
diff
changeset
|
361 |
revsetpredicate = eh.revsetpredicate |
4329
798298fda3be
exthelper: simplify the ability to register templates
Matt Harbison <matt_harbison@yahoo.com>
parents:
4328
diff
changeset
|
362 |
templatekeyword = eh.templatekeyword |
3080
461c9d940519
evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents:
3074
diff
changeset
|
363 |
|
461c9d940519
evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents:
3074
diff
changeset
|
364 |
# Configuration |
4324
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
365 |
eh.configitem('experimental', 'evolutioncommands', []) |
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
366 |
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
|
367 |
eh.configitem('experimental', 'prunestrip', False) |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
368 |
|
2465
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
369 |
# pre hg 4.0 compat |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
370 |
|
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
371 |
if not util.safehasattr(dirstate.dirstate, 'parentchange'): |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
372 |
import contextlib |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
373 |
|
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
374 |
@contextlib.contextmanager |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
375 |
def parentchange(self): |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
376 |
'''Context manager for handling dirstate parents. |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
377 |
|
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
378 |
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
|
379 |
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
|
380 |
released. |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
381 |
''' |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
382 |
self._parentwriters += 1 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
383 |
yield |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
384 |
# 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
|
385 |
# 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
|
386 |
# 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
|
387 |
# 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
|
388 |
# 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
|
389 |
self._parentwriters -= 1 |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
390 |
dirstate.dirstate.parentchange = parentchange |
479646a3873a
deprecation: fix dirstate.beginparentchange deprecation warning
Boris Feld <boris.feld@octobus.net>
parents:
2460
diff
changeset
|
391 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
392 |
##################################################################### |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
393 |
### Option configuration ### |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
394 |
##################################################################### |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
395 |
|
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
396 |
@eh.reposetup # must be the first of its kin. |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
397 |
def _configureoptions(ui, repo): |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
398 |
# If no capabilities are specified, enable everything. |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
399 |
# 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
|
400 |
evolveopts = repo.ui.configlist('experimental', 'evolution') |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
401 |
if not evolveopts: |
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
402 |
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
|
403 |
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
|
404 |
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
|
405 |
# 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
|
406 |
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
|
407 |
repo.ui.setconfig('server', 'bundle1', False) |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
408 |
|
3365
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
409 |
class trdescrepo(repo.__class__): |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
410 |
|
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
411 |
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
|
412 |
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
|
413 |
tr.desc = desc |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
414 |
return tr |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
415 |
|
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
416 |
repo.__class__ = trdescrepo |
911c91ce686f
caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
417 |
|
1226
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
418 |
@eh.uisetup |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
419 |
def _configurecmdoptions(ui): |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
420 |
# Unregister evolve commands if the command capability is not specified. |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
421 |
# |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
422 |
# 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
|
423 |
# guarantee it happens after the above configuration, but before the |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
424 |
# extsetup functions. |
4324
e913546b9d79
configitems: move the default values to the registrar decorator
Matt Harbison <matt_harbison@yahoo.com>
parents:
4321
diff
changeset
|
425 |
evolvecommands = ui.configlist('experimental', 'evolutioncommands') |
1226
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
426 |
evolveopts = ui.configlist('experimental', 'evolution') |
4235
e30119dfd626
style: fix various flake8 warning
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4184
diff
changeset
|
427 |
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
|
428 |
and 'all' not in evolveopts): |
1441
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
429 |
# 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
|
430 |
whitelist = set() |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
431 |
for cmd in evolvecommands: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
432 |
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
|
433 |
if not matchingevolvecommands: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
434 |
raise error.Abort(_('unknown command: %s') % cmd) |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
435 |
elif len(matchingevolvecommands) > 1: |
1547
425c0700aabd
check-code: make evolve.py comply with check-code
Laurent Charignon <lcharignon@fb.com>
parents:
1536
diff
changeset
|
436 |
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
|
437 |
raise error.Abort(msg % (cmd, matchingevolvecommands)) |
1441
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
438 |
else: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
439 |
whitelist.add(matchingevolvecommands[0]) |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
440 |
for disabledcmd in set(cmdtable) - whitelist: |
a4abe588d77f
evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents:
1440
diff
changeset
|
441 |
del cmdtable[disabledcmd] |
1213
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
442 |
|
7118996bdf43
config: enable all obsolete options
Durham Goode <durham@fb.com>
parents:
1212
diff
changeset
|
443 |
##################################################################### |
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
|
444 |
### 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
|
445 |
##################################################################### |
66c02a2e8e2f
prune: wrap mercurial internal to add parent information in prune marker
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
804
diff
changeset
|
446 |
|
590
02cadd3dc9f4
evolve: adapt to 2.4 code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
589
diff
changeset
|
447 |
getrevs = obsolete.getrevs |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
448 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
449 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
450 |
### Additional Utilities ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
451 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
452 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
453 |
# 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
|
454 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
455 |
# - Function to create markers |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
456 |
# - 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
|
457 |
# - "troubles" method on changectx |
1661 | 458 |
# - 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
|
459 |
# - function to find useful changeset to stabilize |
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 |
### Useful alias |
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 |
@eh.uisetup |
2953
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
465 |
def setupparentcommand(ui): |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
466 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
467 |
_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
|
468 |
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
|
469 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
470 |
@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
|
471 |
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
|
472 |
"""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
|
473 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
478 |
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
|
479 |
kwargs['rev'] = ['.^'] |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
480 |
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
|
481 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
482 |
_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
|
483 |
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
|
484 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
485 |
@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
|
486 |
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
|
487 |
"""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
|
488 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
489 |
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
|
490 |
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
|
491 |
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
|
492 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
493 |
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
|
494 |
kwargs['rev'] = ['.^'] |
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
495 |
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
|
496 |
|
b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2952
diff
changeset
|
497 |
@eh.uisetup |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
498 |
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
|
499 |
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
|
500 |
ui.setconfig('alias', 'odiff', |
4624
c9798965b1f4
revset: switch internal uses and tests to `predecessors` from legacy name
Matt Harbison <matt_harbison@yahoo.com>
parents:
4623
diff
changeset
|
501 |
"diff --hidden --rev 'limit(predecessors(.),1)' --rev .", |
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
|
502 |
'evolve') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
503 |
|
4622
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
504 |
### Unstable revset symbol |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
505 |
|
4622
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
506 |
@eh.revsetpredicate('unstable()') |
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
507 |
def revsetunstable(repo, subset, x): |
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
508 |
"""Changesets with instabilities. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
509 |
""" |
4622
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
510 |
revset.getargs(x, 0, 0, 'unstable takes no arguments') |
1381
61849d45d47e
evolve: move 'troubled()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1380
diff
changeset
|
511 |
troubled = set() |
2845
9fc6a4615ae5
revset: unstable volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2844
diff
changeset
|
512 |
troubled.update(getrevs(repo, 'orphan')) |
2847
a1805a65ce21
revset: bumped volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2846
diff
changeset
|
513 |
troubled.update(getrevs(repo, 'phasedivergent')) |
2846
9c019996bce0
revset: divergent volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2845
diff
changeset
|
514 |
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
|
515 |
troubled = revset.baseset(troubled) |
61849d45d47e
evolve: move 'troubled()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1380
diff
changeset
|
516 |
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
|
517 |
return subset & troubled |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
518 |
|
4622
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
519 |
@eh.revsetpredicate('troubled()') # legacy name |
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
520 |
def revsettroubled(repo, subset, x): |
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
521 |
return revsetunstable(repo, subset, x) |
86f396d2b352
revset: add `unstable` alias for `troubled`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4613
diff
changeset
|
522 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
523 |
### Obsolescence graph |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
524 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
525 |
# 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
|
526 |
|
3870
e0bf44befd6e
evolve: exclude "identical" precursors from the precursors set
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3858
diff
changeset
|
527 |
def _precursors(repo, s, includeidentical=False): |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
528 |
"""Precursor of a changeset""" |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
529 |
cs = set() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
530 |
nm = repo.changelog.nodemap |
2840
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2838
diff
changeset
|
531 |
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
|
532 |
node = repo.changelog.node |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
533 |
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
|
534 |
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
|
535 |
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
|
536 |
continue |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
537 |
pr = nm.get(p[0]) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
538 |
if pr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
539 |
cs.add(pr) |
1383
cf62abb62941
evolve: move 'precursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1382
diff
changeset
|
540 |
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
|
541 |
return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
542 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
543 |
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
|
544 |
"""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
|
545 |
node = repo.changelog.node |
a127f0f3bf5f
evolve: avoid creating changectx object in _allprecursors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1377
diff
changeset
|
546 |
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
|
547 |
seen = set() |
2840
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2838
diff
changeset
|
548 |
allsubjects = repo.obsstore.predecessors |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
549 |
while toproceed: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
550 |
nc = toproceed.pop() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
551 |
for mark in allsubjects.get(nc, ()): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
552 |
np = mark[0] |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
553 |
if np not in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
554 |
seen.add(np) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
555 |
toproceed.append(np) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
556 |
nm = repo.changelog.nodemap |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
557 |
cs = set() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
558 |
for p in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
559 |
pr = nm.get(p) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
560 |
if pr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
561 |
cs.add(pr) |
1384
64c8b8c27811
evolve: move 'allprecursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1383
diff
changeset
|
562 |
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
|
563 |
return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
564 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
565 |
def _successors(repo, s): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
566 |
"""Successors of a changeset""" |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
567 |
cs = set() |
1379
693cdcd809f2
evolve: avoid creating changectx object in _successors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1378
diff
changeset
|
568 |
node = repo.changelog.node |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
569 |
nm = repo.changelog.nodemap |
590
02cadd3dc9f4
evolve: adapt to 2.4 code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
589
diff
changeset
|
570 |
markerbyobj = repo.obsstore.successors |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
571 |
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
|
572 |
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
|
573 |
for sub in p[1]: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
574 |
sr = nm.get(sub) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
575 |
if sr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
576 |
cs.add(sr) |
1385
c2584407afbf
evolve: move 'successors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1384
diff
changeset
|
577 |
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
|
578 |
return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
579 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
580 |
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
|
581 |
"""transitive successors of a subset |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
582 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
583 |
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
|
584 |
marker. """ |
1380
43dcf62237be
evolve: avoid creating changectx object in _allsuccessors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1379
diff
changeset
|
585 |
node = repo.changelog.node |
43dcf62237be
evolve: avoid creating changectx object in _allsuccessors
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1379
diff
changeset
|
586 |
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
|
587 |
seen = set() |
590
02cadd3dc9f4
evolve: adapt to 2.4 code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
589
diff
changeset
|
588 |
allobjects = repo.obsstore.successors |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
589 |
while toproceed: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
590 |
nc = toproceed.pop() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
591 |
for mark in allobjects.get(nc, ()): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
592 |
if mark[2] & haltonflags: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
593 |
continue |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
594 |
for sub in mark[1]: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
595 |
if sub == nullid: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
596 |
continue # should not be here! |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
597 |
if sub not in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
598 |
seen.add(sub) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
599 |
toproceed.append(sub) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
600 |
nm = repo.changelog.nodemap |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
601 |
cs = set() |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
602 |
for s in seen: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
603 |
sr = nm.get(s) |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
604 |
if sr is not None: |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
605 |
cs.add(sr) |
1386
b5eaec8a53d0
evolve: move 'allsuccessors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1385
diff
changeset
|
606 |
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
|
607 |
return cs |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
608 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
609 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
610 |
### Extending revset and template ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
611 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
612 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
613 |
# 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
|
614 |
# they are subject to changes |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
615 |
|
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 |
### XXX I'm not sure this revset is useful |
4328
392f1a6a0763
exthelper: simplify the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents:
4324
diff
changeset
|
618 |
@eh.revsetpredicate('suspended()') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
619 |
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
|
620 |
"""Obsolete changesets with non-obsolete descendants. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
621 |
""" |
1307
677c5da57b9c
evolve: remove unused variables
Laurent Charignon <lcharignon@fb.com>
parents:
1306
diff
changeset
|
622 |
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
|
623 |
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
|
624 |
suspended.sort() |
c431f827f366
evolve: move 'suspended()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1381
diff
changeset
|
625 |
return subset & suspended |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
626 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
627 |
|
4623
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
628 |
@eh.revsetpredicate('predecessors(set)') |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
629 |
def revsetpredecessors(repo, subset, x): |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
630 |
"""Immediate predecessors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
631 |
""" |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
632 |
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
|
633 |
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
|
634 |
s.sort() |
cf62abb62941
evolve: move 'precursors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1382
diff
changeset
|
635 |
return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
636 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
637 |
|
4623
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
638 |
@eh.revsetpredicate('precursors(set)') # legacy name for predecessors |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
639 |
def revsetprecursors(repo, subset, x): |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
640 |
return revsetpredecessors(repo, subset, x) |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
641 |
|
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
642 |
|
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
643 |
@eh.revsetpredicate('allpredecessors(set)') |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
644 |
def revsetallpredecessors(repo, subset, x): |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
645 |
"""Transitive predecessors 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 |
|
4623
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
653 |
@eh.revsetpredicate('allprecursors(set)') # legacy name for allpredecessors |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
654 |
def revsetallprecursors(repo, subset, x): |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
655 |
return revsetallpredecessors(repo, subset, x) |
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
656 |
|
0adb59b55add
revset: add `predecessor` aliases for `precursors` and `allprecursors`
Matt Harbison <matt_harbison@yahoo.com>
parents:
4622
diff
changeset
|
657 |
|
4328
392f1a6a0763
exthelper: simplify the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents:
4324
diff
changeset
|
658 |
@eh.revsetpredicate('successors(set)') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
659 |
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
|
660 |
"""Immediate successors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
661 |
""" |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
662 |
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
|
663 |
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
|
664 |
s.sort() |
c2584407afbf
evolve: move 'successors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1384
diff
changeset
|
665 |
return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
666 |
|
4328
392f1a6a0763
exthelper: simplify the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents:
4324
diff
changeset
|
667 |
@eh.revsetpredicate('allsuccessors(set)') |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
668 |
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
|
669 |
"""Transitive successors of changesets in set. |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
670 |
""" |
1204
161b8f6e7402
evolve: use 3.2+ fullreposet to evaluate argument set (issue4515)
Yuya Nishihara <yuya@tcha.org>
parents:
1203
diff
changeset
|
671 |
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
|
672 |
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
|
673 |
s.sort() |
b5eaec8a53d0
evolve: move 'allsuccessors()' to smarted usage
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1385
diff
changeset
|
674 |
return subset & s |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
675 |
|
1399
9ff6d9240f16
template: add a troubles keyword
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
949
diff
changeset
|
676 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
677 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
678 |
### Various trouble warning ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
679 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
680 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
681 |
# 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
|
682 |
|
3363
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
683 |
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
|
684 |
rev = repo['.'] |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
685 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
686 |
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
|
687 |
return |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
688 |
|
3363
380fa6e8baf2
evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3362
diff
changeset
|
689 |
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
|
690 |
return |
2289
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
691 |
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
|
692 |
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
|
693 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
694 |
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
|
695 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
696 |
# 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
|
697 |
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
|
698 |
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
|
699 |
return |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
700 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
701 |
# 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
|
702 |
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
|
703 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
704 |
if reason == 'pruned': |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
705 |
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
|
706 |
elif reason == 'diverged': |
3154
406992d0d611
evolve: rename --contentdivergent flag to --content-divergent
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3149
diff
changeset
|
707 |
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
|
708 |
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
|
709 |
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
|
710 |
elif reason == 'superseed': |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
711 |
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
|
712 |
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
|
713 |
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
|
714 |
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
|
715 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
716 |
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
|
717 |
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
|
718 |
else: |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
719 |
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
|
720 |
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
|
721 |
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
|
722 |
solvemsg = msg % successorsmsg |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
723 |
else: |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
724 |
raise ValueError(reason) |
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
725 |
|
61d073590fb7
ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
2286
diff
changeset
|
726 |
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
|
727 |
|
3691
96cb98989d57
evolve: use in code filtered error for 4.6
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3690
diff
changeset
|
728 |
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
|
729 |
@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
|
730 |
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
|
731 |
"""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
|
732 |
|
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
|
733 |
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
|
734 |
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
|
735 |
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
|
736 |
|
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 |
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
|
738 |
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
|
739 |
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
|
740 |
|
3691
96cb98989d57
evolve: use in code filtered error for 4.6
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3690
diff
changeset
|
741 |
# 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
|
742 |
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
|
743 |
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
|
744 |
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
|
745 |
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
|
746 |
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
|
747 |
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
|
748 |
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
|
749 |
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
|
750 |
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
|
751 |
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
|
752 |
|
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 |
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
|
754 |
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
|
755 |
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
|
756 |
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
|
757 |
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
|
758 |
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
|
759 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
760 |
@eh.wrapcommand("update") |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
761 |
@eh.wrapcommand("pull") |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
762 |
def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
763 |
"""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
|
764 |
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
|
765 |
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
|
766 |
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
|
767 |
|
1452
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
768 |
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
|
769 |
_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
|
770 |
wlock = None |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
771 |
try: |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
772 |
wlock = repo.wlock() |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
773 |
repo._afterlock(warnobsolete) |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
774 |
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
|
775 |
finally: |
1bcbd14cf159
merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1451
diff
changeset
|
776 |
lockmod.release(wlock) |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
777 |
return res |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
778 |
|
1527
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
779 |
@eh.wrapcommand("parents") |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
780 |
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
|
781 |
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
|
782 |
_warnobsoletewc(ui, repo) |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
783 |
return res |
e080d2ae2656
parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1519
diff
changeset
|
784 |
|
1122
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
785 |
@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
|
786 |
def push(orig, repo, *args, **opts): |
492
7ecd41520dae
rename `stabilize` to `evolve`
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
491
diff
changeset
|
787 |
"""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
|
788 |
""" |
1122
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
789 |
try: |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
790 |
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
|
791 |
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
|
792 |
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
|
793 |
"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
|
794 |
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
|
795 |
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
|
796 |
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
|
797 |
ex.hint = hint |
c8750f4388c8
evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents:
1120
diff
changeset
|
798 |
raise |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
799 |
|
788
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
800 |
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
|
801 |
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
|
802 |
if evolvestate: |
1640 | 803 |
# i18n: column positioning for "hg summary" |
3198
390c87f8c65d
summaryhook: respect -q flag
Martin von Zweigbergk <martinvonz@google.com>
parents:
3197
diff
changeset
|
804 |
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
|
805 |
|
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
806 |
@eh.extsetup |
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
807 |
def obssummarysetup(ui): |
e973dd5bf583
evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents:
776
diff
changeset
|
808 |
cmdutil.summaryhooks.add('evolve', summaryhook) |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
809 |
|
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
810 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
811 |
### Old Evolve extension content ### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
812 |
##################################################################### |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
813 |
|
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
814 |
### new command |
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
815 |
############################# |
716
4c0f6d555032
prune: add --user and --date options
Levi Bard <levi@unity3d.com>
parents:
715
diff
changeset
|
816 |
|
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
817 |
@eh.uisetup |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
818 |
def _installimportobsolete(ui): |
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
819 |
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
|
820 |
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
|
821 |
_('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
|
822 |
'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
|
823 |
|
3672
f4d5ef9ba074
import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3671
diff
changeset
|
824 |
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
|
825 |
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
|
826 |
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
|
827 |
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
|
828 |
|
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
829 |
@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
|
830 |
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
|
831 |
expected = {'node': None} |
3673
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
832 |
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
|
833 |
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
|
834 |
|
3673
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
835 |
def extract(*args, **kwargs): |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
836 |
ret = oldextract(*args, **kwargs) |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
837 |
_getnodefrompatch(ret, expected) |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
838 |
return ret |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
839 |
try: |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
840 |
patch.extract = extract |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
841 |
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
|
842 |
finally: |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
843 |
patch.extract = oldextract |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
844 |
else: |
9c12b6520a20
import: adapt to fd1dd79cff20
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3672
diff
changeset
|
845 |
_getnodefrompatch(hunk, expected) |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
846 |
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
|
847 |
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
|
848 |
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
|
849 |
and created != expected['node']): |
4449
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
850 |
tr = repo.transaction('import-obs') |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
851 |
try: |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
852 |
metadata = {'user': ui.username()} |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
853 |
repo.obsstore.create(tr, expected['node'], (created,), |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
854 |
metadata=metadata) |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
855 |
tr.close() |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
856 |
finally: |
4a00de50bb3b
evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4342
diff
changeset
|
857 |
tr.release() |
953
a02e5916a7e3
import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
952
diff
changeset
|
858 |
return ret |
930
cac35bef8aee
import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
927
diff
changeset
|
859 |
|
81
5cec25ce019c
Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff
changeset
|
860 |
|
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
861 |
def _deprecatealias(oldalias, newalias): |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
862 |
'''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
|
863 |
|
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
864 |
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
|
865 |
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
|
866 |
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
|
867 |
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
|
868 |
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
|
869 |
|
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
870 |
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
|
871 |
''' |
1226
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
872 |
try: |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
873 |
aliases, entry = cmdutil.findcmd(newalias, cmdtable) |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
874 |
except error.UnknownCommand: |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
875 |
# Commands may be disabled |
901d2f4b21a9
config: allow disabling commands
Durham Goode <durham@fb.com>
parents:
1221
diff
changeset
|
876 |
return |
1680
7caa5f2040c5
py3: use items() instead of iteritems()
timeless@gmail.com
parents:
1679
diff
changeset
|
877 |
for alias, e in cmdtable.items(): |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
878 |
if e is entry: |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
879 |
break |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
880 |
|
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
881 |
synopsis = '(DEPRECATED)' |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
882 |
if len(entry) > 2: |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
883 |
fn, opts, _syn = entry |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
884 |
else: |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
885 |
fn, opts, = entry |
1496 | 886 |
deprecationwarning = _('%s have been deprecated in favor of %s\n') % ( |
887 |
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
|
888 |
|
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
889 |
def newfn(*args, **kwargs): |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
890 |
ui = args[0] |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
891 |
ui.warn(deprecationwarning) |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
892 |
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
|
893 |
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
|
894 |
cmdwrapper = eh.command(oldalias, opts, synopsis) |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
895 |
cmdwrapper(newfn) |
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
896 |
|
895
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
897 |
@eh.extsetup |
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
898 |
def deprecatealiases(ui): |
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
899 |
_deprecatealias('gup', 'next') |
17ac69db9329
evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents:
894
diff
changeset
|
900 |
_deprecatealias('gdown', 'previous') |
894
4f21a3279a60
evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents:
890
diff
changeset
|
901 |
|
2745
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
902 |
def _gettopic(ctx): |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
903 |
"""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
|
904 |
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
|
905 |
|
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
906 |
def _gettopicidx(ctx): |
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
907 |
"""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
|
908 |
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
|
909 |
|
2742
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
910 |
def _getcurrenttopic(repo): |
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
911 |
return getattr(repo, 'currenttopic', '') |
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
912 |
|
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
913 |
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
|
914 |
if dryrun: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
915 |
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
|
916 |
if bookmark is not None: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
917 |
repo.ui.write(_('hg bookmark %s -r %s;\n') |
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
918 |
% (bookmark, target)) |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
919 |
else: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
920 |
updatecheck = None |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
921 |
# --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
|
922 |
# config option |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
923 |
if mergeopt: |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
924 |
updatecheck = 'none' |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
925 |
try: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
926 |
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
|
927 |
updatecheck=updatecheck) |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
928 |
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
|
929 |
# 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
|
930 |
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
|
931 |
raise |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
932 |
if not ret: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
933 |
tr = lock = None |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
934 |
try: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
935 |
lock = repo.lock() |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
936 |
tr = repo.transaction('previous') |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
937 |
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
|
938 |
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
|
939 |
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
|
940 |
else: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
941 |
bookmarksmod.deactivate(repo) |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
942 |
tr.close() |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
943 |
finally: |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
944 |
lockmod.release(tr, lock) |
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
945 |
|
3196
94e5235e95f5
evolve: make prev/next respect --quiet flag (issue5742)
Martin von Zweigbergk <martinvonz@google.com>
parents:
3185
diff
changeset
|
946 |
if not repo.ui.quiet: |
94e5235e95f5
evolve: make prev/next respect --quiet flag (issue5742)
Martin von Zweigbergk <martinvonz@google.com>
parents:
3185
diff
changeset
|
947 |
displayer.show(target) |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
948 |
|
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
949 |
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
|
950 |
target = bookmark = None |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
951 |
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
|
952 |
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
|
953 |
parents = p1.parents() |
2742
64fb1a082f58
prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2741
diff
changeset
|
954 |
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
|
955 |
|
b38112b43a27
prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2743
diff
changeset
|
956 |
# 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
|
957 |
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
|
958 |
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
|
959 |
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
|
960 |
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
|
961 |
|
51d669b16fa8
prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2739
diff
changeset
|
962 |
# 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
|
963 |
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
|
964 |
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
|
965 |
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
|
966 |
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
|
967 |
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
|
968 |
elif len(parents) == 1: |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
969 |
target = parents[0] |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
970 |
bookmark = None |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
971 |
if movebookmark: |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
972 |
bookmark = repo._activebookmark |
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
973 |
else: |
3551
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
974 |
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
|
975 |
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
|
976 |
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
|
977 |
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
|
978 |
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
|
979 |
displayer.show(p) |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
980 |
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
|
981 |
else: |
ce346c6165c6
prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3550
diff
changeset
|
982 |
target = repo[choosedrev] |
2739
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
983 |
return target, bookmark |
2736
3c87d5276394
prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2735
diff
changeset
|
984 |
|
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
985 |
@eh.command( |
4184
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
986 |
'previous', |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
987 |
[('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
|
988 |
_('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
|
989 |
('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
|
990 |
('', '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
|
991 |
('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
|
992 |
_('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
|
993 |
'[OPTION]...', |
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
994 |
helpbasic=True) |
1160
e29a813f6af5
Make next/prev only move bookmarks optionally
Ryan McElroy <rmcelroy@fb.com>
parents:
1157
diff
changeset
|
995 |
def cmdprevious(ui, repo, **opts): |
1572
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
996 |
"""update to parent revision |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
997 |
|
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
998 |
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
|
999 |
wlock = None |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1000 |
dryrunopt = opts['dry_run'] |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1001 |
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
|
1002 |
if not dryrunopt: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1003 |
wlock = repo.wlock() |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1004 |
try: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1005 |
wkctx = repo[None] |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1006 |
wparents = wkctx.parents() |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1007 |
if len(wparents) != 1: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1008 |
raise error.Abort(_('merge in progress')) |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1009 |
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
|
1010 |
# 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
|
1011 |
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
|
1012 |
pass |
e73a73b27f3e
prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3779
diff
changeset
|
1013 |
else: |
4238
18648e1aded0
prev: use the `hint` argument of bail if changed
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4236
diff
changeset
|
1014 |
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
|
1015 |
|
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
|
1016 |
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
|
1017 |
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
|
1018 |
|
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1019 |
template = shorttemplate |
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1020 |
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
|
1021 |
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
|
1022 |
|
3c28f8a3a5a5
prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4160
diff
changeset
|
1023 |
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
|
1024 |
|
7d86594cb829
prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2738
diff
changeset
|
1025 |
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
|
1026 |
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
|
1027 |
if target is not None: |
2795
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1028 |
backup = repo.ui.backupconfig('_internal', 'keep-topic') |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1029 |
try: |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1030 |
if topic and _getcurrenttopic(repo) != _gettopic(target): |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1031 |
repo.ui.setconfig('_internal', 'keep-topic', 'yes', |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1032 |
source='topic-extension') |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1033 |
_prevupdate(repo, displayer, target, bookmark, dryrunopt, |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1034 |
mergeopt) |
2795
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1035 |
finally: |
0dc119ed06b4
compat: avoid using configoveride
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2782
diff
changeset
|
1036 |
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
|
1037 |
return 0 |
1500 | 1038 |
else: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1039 |
return 1 |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1040 |
finally: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1041 |
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
|
1042 |
|
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1043 |
@eh.command( |
4184
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
1044 |
'next', |
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1045 |
[('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
|
1046 |
_('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
|
1047 |
('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
|
1048 |
('', '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
|
1049 |
('', '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
|
1050 |
('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
|
1051 |
_('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
|
1052 |
'[OPTION]...', |
b9e0cc531b2b
evolve: adapt for changed @command decorator
Martin von Zweigbergk <martinvonz@google.com>
parents:
4161
diff
changeset
|
1053 |
helpbasic=True) |
1160
e29a813f6af5
Make next/prev only move bookmarks optionally
Ryan McElroy <rmcelroy@fb.com>
parents:
1157
diff
changeset
|
1054 |
def cmdnext(ui, repo, **opts): |
1572
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1055 |
"""update to next child revision |
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1056 |
|
4248
51b69f3dfc0b
next: update the command description
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4247
diff
changeset
|
1057 |
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
|
1058 |
behavior. |
1572
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1059 |
|
44e9c0a264de
evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents:
1571
diff
changeset
|
1060 |
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
|
1061 |
""" |
1742
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1062 |
wlock = None |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1063 |
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
|
1064 |
if not dryrunopt: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1065 |
wlock = repo.wlock() |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1066 |
try: |
1741
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1067 |
wkctx = repo[None] |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1068 |
wparents = wkctx.parents() |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1069 |
if len(wparents) != 1: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1070 |
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
|
1071 |
|
4233
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1072 |
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
|
1073 |
topic = _getcurrenttopic(repo) |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1074 |
filtered = set() |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1075 |
template = shorttemplate |
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1076 |
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
|
1077 |
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
|
1078 |
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
|
1079 |
template = utility.stacktemplate |
4342
914b9e55f76e
next: populate stacktemplate to the missed _nextevolve function
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4329
diff
changeset
|
1080 |
opts['stacktemplate'] = True |
4233
efd542942d98
next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4184
diff
changeset
|
1081 |
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
|
1082 |
|
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
|
1083 |
# 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
|
1084 |
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
|
1085 |
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
|
1086 |
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
|
1087 |
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
|
1088 |
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
|
1089 |
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
|
1090 |
|
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1091 |
# 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
|
1092 |
# 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
|
1093 |
# the aspiring children itself. |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1094 |
aspirants = set(aspchildren) |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1095 |
for aspchild in aspchildren: |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1096 |
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
|
1097 |
if possdests & aspirants: |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1098 |
filtered.add(aspchild) |
a07cd1d076bb
next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4250
diff
changeset
|
1099 |
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
|
1100 |
if aspchildren: |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1101 |
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
|
1102 |
|
4247
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1103 |
# 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
|
1104 |
if needevolve and opts['evolve']: |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1105 |
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
|
1106 |
cmdutil.bailifchanged(repo, hint=hint) |
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1107 |
|
820a25dcea58
next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4242
diff
changeset
|
1108 |
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
|
1109 |
# 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
|
1110 |
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
|
1111 |
pass |
27cf636b2f4d
next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3781
diff
changeset
|
1112 |
else: |
4239
7e274734cc2c
next: use the `hint` argument of bail if changed
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4238
diff
changeset
|
1113 |
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
|
1114 |
|
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1115 |
if len(children) == 1: |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1116 |
c = children[0] |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1117 |
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
|
1118 |
elif children: |
3547
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1119 |
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
|
1120 |
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
|
1121 |
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
|
1122 |
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
|
1123 |
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
|
1124 |
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
|
1125 |
displayer.show(c) |
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1126 |
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
|
1127 |
return 1 |
3547
78abffad8626
next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3546
diff
changeset
|
1128 |
else: |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1129 |
return _updatetonext(ui, repo, repo[choosedrev], displayer, opts) |
1500 | 1130 |
else: |
4242
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1131 |
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
|
1132 |
if filtered: |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1133 |
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
|
1134 |
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
|
1135 |
else: |
8c05184672ae
evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1739
diff
changeset
|
1136 |
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
|
1137 |
if aspchildren: |
a07df2aa1b7d
oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4241
diff
changeset
|
1138 |
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
|
1139 |
'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
|
1140 |
ui.warn(msg % len(aspchildren)) |
3550
78d3ba4e17ac
next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3549
diff
changeset
|
1141 |
return 1 |
4250
781d058d14f9
cleanup: avoid a Yoda condition
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4248
diff
changeset
|
1142 |
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
|
1143 |
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
|
1144 |
" 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
|
1145 |
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
|
1146 |
aspchildren, cheader) |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1147 |
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
|
1148 |
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
|
1149 |
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
|
1150 |
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
|
1151 |
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
|
1152 |
return 1 |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1153 |
else: |
802441114400
next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3548
diff
changeset
|
1154 |
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
|
1155 |
else: |
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1156 |
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
|
1157 |
finally: |
970a4c13ebc3
evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents:
1741
diff
changeset
|
1158 |
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
|
1159 |
|
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1160 |
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
|
1161 |
"""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
|
1162 |
|
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1163 |
cmdutil.bailifchanged(repo) |
3653
d9682c41ea2f
evolve: restore bookmarks correctly after `hg evolve --abort`
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3641
diff
changeset
|
1164 |
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
|
1165 |
'bookmarkchanges': []}) |
4609
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1166 |
with repo.wlock(), repo.lock(): |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1167 |
tr = repo.transaction("evolve") |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1168 |
with util.acceptintervention(tr): |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1169 |
result = evolvecmd._solveone(ui, repo, repo[aspchildren], |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1170 |
evolvestate, opts.get('dry_run'), |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1171 |
False, |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1172 |
lambda: None, category='orphan', |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1173 |
stacktmplt=opts.get('stacktemplate', |
fe2999627556
next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4489
diff
changeset
|
1174 |
False)) |
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1175 |
# 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
|
1176 |
if result[0] and result[1]: |
4613
30a544904238
messages: standardize on "working copy is now at" including "is"
Martin von Zweigbergk <martinvonz@google.com>
parents:
4609
diff
changeset
|
1177 |
ui.status(_('working directory is now at %s\n') |
3548
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1178 |
% 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
|
1179 |
return 0 |
79d995cb8152
next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3547
diff
changeset
|
1180 |
|
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1181 |
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
|
1182 |
""" 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
|
1183 |
required """ |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1184 |
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
|
1185 |
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
|
1186 |
if opts.get('dry_run'): |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1187 |
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
|
1188 |
if shouldmove: |
3583
944a8c27d27b
__init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3574
diff
changeset
|
1189 |
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
|
1190 |
else: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1191 |
updatecheck = None |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1192 |
# --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
|
1193 |
# config option |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1194 |
if opts['merge']: |
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1195 |
updatecheck = 'none' |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1196 |
try: |
3813
27e7ed2d13a6
next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3784
diff
changeset
|
1197 |
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
|
1198 |
updatecheck=updatecheck) |
3784
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1199 |
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
|
1200 |
# 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
|
1201 |
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
|
1202 |
raise |
838fc71ddb9c
next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3782
diff
changeset
|
1203 |
|
3539
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1204 |
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
|
1205 |
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
|
1206 |
try: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1207 |
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
|
1208 |
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
|
1209 |
if shouldmove: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1210 |
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
|
1211 |
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
|
1212 |
else: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1213 |
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
|
1214 |
tr.close() |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1215 |
finally: |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1216 |
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
|
1217 |
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
|
1218 |
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
|
1219 |
return 0 |
9bd64091e880
next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3535
diff
changeset
|
1220 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1221 |
@eh.wrapcommand('commit') |
116
64ca29eef349
Add a -o option to commit
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
113
diff
changeset
|
1222 |
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
|
1223 |
tr = None |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1224 |
if kwargs.get('amend', False): |
1255
a2d4901e211e
commit: avoid potential deadlock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1253
diff
changeset
|
1225 |
wlock = lock = None |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1226 |
else: |
1255
a2d4901e211e
commit: avoid potential deadlock
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1253
diff
changeset
|
1227 |
wlock = repo.wlock() |
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1228 |
lock = repo.lock() |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1229 |
try: |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1230 |
obsoleted = kwargs.get('obsolete', []) |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1231 |
if obsoleted: |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1232 |
obsoleted = repo.set('%lr', obsoleted) |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1233 |
result = orig(ui, repo, *arg, **kwargs) |
1659 | 1234 |
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
|
1235 |
new = repo['tip'] |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1236 |
oldbookmarks = [] |
444
aedb6b8ace86
drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
443
diff
changeset
|
1237 |
markers = [] |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1238 |
for old in obsoleted: |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1239 |
oldbookmarks.extend(repo.nodebookmarks(old.node())) |
444
aedb6b8ace86
drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
443
diff
changeset
|
1240 |
markers.append((old, (new,))) |
aedb6b8ace86
drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
443
diff
changeset
|
1241 |
if markers: |
3694
c0d5e0929f8b
compat: from compatibility layer for createmarkers
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3691
diff
changeset
|
1242 |
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
|
1243 |
bmchanges = [] |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1244 |
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
|
1245 |
bmchanges.append((book, new.node())) |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1246 |
if oldbookmarks: |
1558
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1247 |
if not wlock: |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1248 |
wlock = repo.wlock() |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1249 |
if not lock: |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1250 |
lock = repo.lock() |
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1251 |
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
|
1252 |
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
|
1253 |
tr.close() |
137
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1254 |
return result |
bbc653876876
fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
133
diff
changeset
|
1255 |
finally: |
1558
4706475e0c5d
commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents:
1557
diff
changeset
|
1256 |
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
|
1257 |
|
1220
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1258 |
@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
|
1259 |
('', '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
|
1260 |
"backup bundle")), |
1220
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 |
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
|
1263 |
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
|
1264 |
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
|
1265 |
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
|
1266 |
|
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1267 |
if kwargs.get('force'): |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1268 |
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
|
1269 |
"enabled\n")) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1270 |
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
|
1271 |
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
|
1272 |
"evolve enabled\n")) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1273 |
|
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1274 |
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
|
1275 |
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
|
1276 |
revs = repo.revs("(%ld)::", revs) |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1277 |
kwargs['rev'] = [] |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1278 |
kwargs['new'] = [] |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1279 |
kwargs['succ'] = [] |
71240f696f26
strip: add the option for wrapping the strip command
Durham Goode <durham@fb.com>
parents:
1219
diff
changeset
|
1280 |
kwargs['biject'] = False |
2772
394b836e475b
commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2766
diff
changeset
|
1281 |
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
|
1282 |
|
491
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1283 |
@eh.extsetup |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1284 |
def oldevolveextsetup(ui): |
6989d8fe4ed2
merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
490
diff
changeset
|
1285 |
entry = cmdutil.findcmd('commit', commands.table)[1] |
303 | 1286 |
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
|
1287 |
_("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
|
1288 |
|
1302
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1289 |
@eh.wrapfunction(obsolete, '_checkinvalidmarkers') |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1290 |
def _checkinvalidmarkers(orig, markers): |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1291 |
"""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
|
1292 |
|
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1293 |
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
|
1294 |
subtle handling. |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1295 |
""" |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1296 |
if 'debugobsconvert' in sys.argv: |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1297 |
return |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1298 |
for mark in markers: |
ebcf23fe3032
evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1301
diff
changeset
|
1299 |
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
|
1300 |
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
|
1301 |
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
|
1302 |
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
|
1303 |
|
2043
c64300906a32
exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2041
diff
changeset
|
1304 |
@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
|
1305 |
'debugobsconvert', |
2053
f3765c4a352a
exchange: rename the module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
2051
diff
changeset
|
1306 |
[('', '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
|
1307 |
'') |
04bd66779a1f
obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
1157
diff
changeset
|
1308 |
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
|
1309 |
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
|
1310 |
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
|
1311 |
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
|
1312 |
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
|
1313 |
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
|
1314 |
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
|
1315 |
known = set() |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1316 |
markers = [] |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1317 |
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
|
1318 |
# 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
|
1319 |
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
|
1320 |
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
|
1321 |
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
|
1322 |
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
|
1323 |
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
|
1324 |
continue |
723f5b505c48
debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2745
diff
changeset
|
1325 |
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
|
1326 |
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
|
1327 |
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
|
1328 |
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
|
1329 |
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
|
1330 |
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
|
1331 |
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
|
1332 |
|
864
401da1b38cca
discovery: implement a discovery process and use it for push
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
863
diff
changeset
|
1333 |
|
1827
15ec53d46f44
compat: drop handling of ancestral 'helploader' caller
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
1826
diff
changeset
|
1334 |
def _helploader(ui): |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1335 |
return help.gettext(evolutionhelptext) |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1336 |
|
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1337 |
@eh.uisetup |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1338 |
def _setuphelp(ui): |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1339 |
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
|
1340 |
if entry[0] == "evolution": |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1341 |
break |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1342 |
else: |
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1343 |
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
|
1344 |
_helploader)) |
1414
4198e2fad6ba
evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1413
diff
changeset
|
1345 |
help.helptable.sort() |
1567
536fdfa3c48b
evolve: extract logic to new method _relocatecommit
Shusen LIU <liushusen@fb.com>
parents:
1566
diff
changeset
|
1346 |
|
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1347 |
evolvestateversion = 0 |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1348 |
|
3839
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1349 |
def _evolvemessage(): |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1350 |
_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
|
1351 |
'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
|
1352 |
'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
|
1353 |
'(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
|
1354 |
return cmdutil._commentlines(_msg) |
ac0717f23921
evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3836
diff
changeset
|
1355 |
|
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1356 |
@eh.uisetup |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1357 |
def setupevolveunfinished(ui): |
4691
214dab733124
pick: rename variable for unfinishedstates
Anton Shestakov <av6@dwimlabs.net>
parents:
4664
diff
changeset
|
1358 |
estate = ('evolvestate', False, False, _('evolve in progress'), |
214dab733124
pick: rename variable for unfinishedstates
Anton Shestakov <av6@dwimlabs.net>
parents:
4664
diff
changeset
|
1359 |
_("use 'hg evolve --continue' or 'hg evolve --abort' to abort")) |
214dab733124
pick: rename variable for unfinishedstates
Anton Shestakov <av6@dwimlabs.net>
parents:
4664
diff
changeset
|
1360 |
cmdutil.unfinishedstates.append(estate) |
4692
a9cf0ba6e6c7
pick: register pickstate as an unfinished state
Anton Shestakov <av6@dwimlabs.net>
parents:
4691
diff
changeset
|
1361 |
pstate = ('pickstate', False, False, _('pick in progress'), |
a9cf0ba6e6c7
pick: register pickstate as an unfinished state
Anton Shestakov <av6@dwimlabs.net>
parents:
4691
diff
changeset
|
1362 |
_("use 'hg pick --continue' or 'hg pick --abort' to abort")) |
a9cf0ba6e6c7
pick: register pickstate as an unfinished state
Anton Shestakov <av6@dwimlabs.net>
parents:
4691
diff
changeset
|
1363 |
cmdutil.unfinishedstates.append(pstate) |
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1364 |
|
3472
05bd493d496d
evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3470
diff
changeset
|
1365 |
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
|
1366 |
pickresolved = ('pickstate', _('hg pick --continue')) |
3472
05bd493d496d
evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3470
diff
changeset
|
1367 |
cmdutil.afterresolvedstates.append(afterresolved) |
4054
46cd437fd3d2
pick: fix last references of grab in code
Boris Feld <boris.feld@octobus.net>
parents:
4052
diff
changeset
|
1368 |
cmdutil.afterresolvedstates.append(pickresolved) |
3472
05bd493d496d
evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3470
diff
changeset
|
1369 |
|
3926
35172bd95e57
compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3870
diff
changeset
|
1370 |
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
|
1371 |
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
|
1372 |
_evolvemessage) |
35172bd95e57
compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3870
diff
changeset
|
1373 |
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
|
1374 |
|
1597
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1375 |
@eh.wrapfunction(hg, 'clean') |
7876ed4fceb7
evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
1594
diff
changeset
|
1376 |
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
|
1377 |
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
|
1378 |
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
|
1379 |
return ret |