annotate hgext3rd/evolve/__init__.py @ 6696:e0712a00154e

branching: merge with stable
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 07 Feb 2024 14:57:11 -0300
parents 4f0ec124224f a93758f6f937
children cc49139f580f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
1 # Copyright 2011 Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
2 # Logilab SA <contact@logilab.fr>
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
3 # Pierre-Yves David <pierre-yves.david@ens-lyon.org>
519
9825c7da5b54 ensure all file have a copyright notice
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 517
diff changeset
4 # Patrick Mezard <patrick@mezard.eu>
4281
ac4bb904f5d8 exthelper: clarify copyright and licence for the module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4261
diff changeset
5 # Octobus <contact@octobus.net>
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
6 #
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
7 # This software may be used and distributed according to the terms of the
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
8 # GNU General Public License version 2 or any later version.
2032
dd7e092a854a flake8: update the code sources to fixes a horde of pyflake warnings
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2024
diff changeset
9 """extends Mercurial feature related to Changeset Evolution
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
10
2292
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
11 This extension:
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
12
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
13 - provides several commands to mutate history and deal with resulting issues,
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
14 - enable the changeset-evolution feature for Mercurial,
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
15 - improves some aspect of the early implementation in Mercurial core,
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
16
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
17 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
18 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
19 changeset evolution.
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
20
2678
da2b3e5e4f69 docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents: 2667
diff changeset
21 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
22 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
23 revision, etc).
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
24
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
25 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
26 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
27 speeding up such operation.
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
28
f026e85bd0b2 evolve: update extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2290
diff changeset
29 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
30 backported to older version of Mercurial by this extension. Some older
6024
18aa756353a7 evolve: formally remove 4.6 support
Anton Shestakov <av6@dwimlabs.net>
parents: 5990
diff changeset
31 experimental protocols are also supported for a longer time in the extension to
18aa756353a7 evolve: formally remove 4.6 support
Anton Shestakov <av6@dwimlabs.net>
parents: 5990
diff changeset
32 help people transitioning. (The extension is currently compatible down to
6605
595d52e0a063 evolve: mention hg 5.6 in the help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6558
diff changeset
33 Mercurial version 5.6).
2311
26d638e419df auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2294
diff changeset
34
2923
8c2d3c474fc6 doc: make paragraphs before example code end with "::" for reST syntax
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 2895
diff changeset
35 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
36
26d638e419df auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2294
diff changeset
37 [experimental]
26d638e419df auto-push: move config help in the extension help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2294
diff changeset
38 # 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
39 # 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
40 # * 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
41 # * 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
42 # * 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
43 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
44
6233
b829e905d36b evolve: reword obsdiscovery help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6202
diff changeset
45 # For some large repositories with few markers, the current method for
b829e905d36b evolve: reword obsdiscovery help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6202
diff changeset
46 # obsolescence marker discovery can get in the way. You can disable it by
b829e905d36b evolve: reword obsdiscovery help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6202
diff changeset
47 # setting the following configuration option to "no". Then all pushes and
b829e905d36b evolve: reword obsdiscovery help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6202
diff changeset
48 # pulls will re-exchange all markers every time.
2521
29fc90b0e59c obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2504
diff changeset
49 evolution.obsdiscovery = yes
29fc90b0e59c obsdiscovery: add an option to disable all obsdiscovery
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2504
diff changeset
50
4664
a3f9f8d3bde5 doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4644
diff changeset
51 Obsolescence Markers Discovery
5780
e117cf7401db doc: switch rst `=` section underlines to `-`
Kyle Lippincott <spectral@google.com>
parents: 5779
diff changeset
52 ------------------------------
2460
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
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 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
55 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
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 "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
58 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
59 in large memory or CPU Load.
2460
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
diff changeset
60
4664
a3f9f8d3bde5 doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4644
diff changeset
61 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
62
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
diff changeset
63 [experimental]
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
diff changeset
64
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
diff changeset
65 # 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
66 # default to "yes"
2460
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
diff changeset
67 obshashrange = yes
64cc0b059073 obshashrange: document the experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2443
diff changeset
68
3368
7310f3ef6dee caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3365
diff changeset
69 # 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
70 # 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
71 # (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
72 # 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
73 # (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
74 # 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
75 # 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
76 # (default).
3368
7310f3ef6dee caches: add a 'auto' option for obshashrange cache warming
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3365
diff changeset
77 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
78
4664
a3f9f8d3bde5 doc: clarify the status of configuration of the obshashrange protocol
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4644
diff changeset
79 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
80 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
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 $ hg debugupdatecache
2715
61e73c8fe169 obshashrange: add cache warming instruction to the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2714
diff changeset
83
2678
da2b3e5e4f69 docs: some fixes to the help text
Pulkit Goyal <7895pulkit@gmail.com>
parents: 2667
diff changeset
84 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
85 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
86
84982b441e82 documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2465
diff changeset
87 [extensions]
84982b441e82 documentation: recomment using blackbox with the obshashrange experiment
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2465
diff changeset
88 blackbox =
2493
3ee8e9a12f41 doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents: 2488
diff changeset
89
5990
d28c9f359464 evolve: remove experimental.obshashrange.lru-size docs
Anton Shestakov <av6@dwimlabs.net>
parents: 5987
diff changeset
90 Finally one more option is available to help tame the experimental
2687
4a02781d90ce evolve: fix documentation formatting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2678
diff changeset
91 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
92
d95006fe4dd0 stablerange: use last recently used caching for revisions associated to ranges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2493
diff changeset
93 [experimental]
2551
ecd47c63b6de obshashrange: add an option to protect from accidental activation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2550
diff changeset
94 # 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
95 # 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
96 # 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
97 # 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
98 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
99
6233
b829e905d36b evolve: reword obsdiscovery help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6202
diff changeset
100 For very large repositories, it might be useful to disable obsmarkers discovery
b829e905d36b evolve: reword obsdiscovery help text
Anton Shestakov <av6@dwimlabs.net>
parents: 6202
diff changeset
101 (make sure you follow release announcements to know when you might want to 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
102 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
103
7eff426f999b evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2699
diff changeset
104 [experimental]
7eff426f999b evolve: explain how to disable markers discovery in the documentation
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2699
diff changeset
105 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
106
2493
3ee8e9a12f41 doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents: 2488
diff changeset
107 Effect Flag Experiment
5780
e117cf7401db doc: switch rst `=` section underlines to `-`
Kyle Lippincott <spectral@google.com>
parents: 5779
diff changeset
108 ----------------------
2493
3ee8e9a12f41 doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents: 2488
diff changeset
109
2689
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
110 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
111 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
112 an obsolete changeset and its tipmost successors.
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
113
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
114 Evolve currently records:
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
115
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
116 - Meta changes, user, date
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
117 - 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
118 - Description, was the commit description edited
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
119 - 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
120
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
121 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
122 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
123 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
124
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
125 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
126 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
127 the effect flag attached.
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
128
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
129 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
130
3ee8e9a12f41 doc: add documentation about effectflag experiment
Boris Feld <boris.feld@octobus.net>
parents: 2488
diff changeset
131 [experimental]
2689
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
132 # 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
133 # evolution.effect-flags = false
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 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
136 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
137
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
138 $ hg commit -m "WIP
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
139 $ hg commit -m "A better commit message!"
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
140 $ hg obslog .
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
141 @ 8e9045855628 (3133) A better commit message!
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
142 |
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
143 x 7863a5bb5763 (3132) WIP
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
144 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
145
9e84b407fde5 doc: update effect flag documentation
Boris Feld <boris.feld@octobus.net>
parents: 2687
diff changeset
146 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
147 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
148 the effect flag recording.
2556
d5b97b5dec5b doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2551
diff changeset
149
5796
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
150 In-memory Evolve Experiment
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
151 ---------------------------
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
152
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
153 The :hg:`evolve` command normally creates new changesets by writing the
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
154 files to the working copy and then committing them from there. You can
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
155 tell it to create the changesets without touching the working copy by
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
156 setting this config::
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
157
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
158 [experimental]
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
159 evolution.in-memory = yes
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
160
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
161 It will still update the working copy in case of conflicts.
c84924d6df35 evolve: document experimental.evolution.in-memory in extension
Martin von Zweigbergk <martinvonz@google.com>
parents: 5791
diff changeset
162
5330
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
163 Template keywords
5780
e117cf7401db doc: switch rst `=` section underlines to `-`
Kyle Lippincott <spectral@google.com>
parents: 5779
diff changeset
164 -----------------
5330
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
165
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
166 Evolve provides one template keyword that helps explore obsolescence history:
2556
d5b97b5dec5b doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2551
diff changeset
167
5330
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
168 - obsorigin, for each changeset display a line summarizing what changed
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
169 between the changeset and its predecessors. Depending on the verbosity
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
170 level (-q and -v) it displays the users that created the obsmarkers and the
a6e2bb90db24 evolve: rewrite template keywords section and mention obsorigin
Anton Shestakov <av6@dwimlabs.net>
parents: 5329
diff changeset
171 date range of these operations.
2556
d5b97b5dec5b doc: document the evolve templates
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2551
diff changeset
172
5329
9d8bf2f05810 evolve: don't describe {obsfate}, but mention that it was upstreamed
Anton Shestakov <av6@dwimlabs.net>
parents: 5328
diff changeset
173 Evolve used to provide these template keywords, which since have been included
9d8bf2f05810 evolve: don't describe {obsfate}, but mention that it was upstreamed
Anton Shestakov <av6@dwimlabs.net>
parents: 5328
diff changeset
174 in core Mercurial (see :hg:`help templates -v`):
2591
1991935fb603 obsfate: add a new obsfate template
Boris Feld <boris.feld@octobus.net>
parents: 2586
diff changeset
175
5329
9d8bf2f05810 evolve: don't describe {obsfate}, but mention that it was upstreamed
Anton Shestakov <av6@dwimlabs.net>
parents: 5328
diff changeset
176 - obsolete
9d8bf2f05810 evolve: don't describe {obsfate}, but mention that it was upstreamed
Anton Shestakov <av6@dwimlabs.net>
parents: 5328
diff changeset
177 - obsfate (including obsfatedata, see also obsfate* template functions)
5328
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
178
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
179 For compatibility, this extension also provides the following aliases to
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
180 template keywords from core Mercurial:
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
181
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
182 - precursors (deprecated, use predecessors instead)
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
183 - successors (deprecated, use successorssets instead)
4e499fbc66c9 evolve: precursors, successors and troubles are just aliases now
Anton Shestakov <av6@dwimlabs.net>
parents: 5230
diff changeset
184 - troubles (deprecated, use instabilities instead)
5808
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
185
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
186 Revset predicates
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
187 -----------------
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
188
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
189 Evolve provides several revset predicates:
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
190
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
191 - unstable
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
192 - troubled (deprecated, use unstable instead)
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
193 - suspended
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
194 - predecessors
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
195 - precursors (deprecated, use predecessors instead)
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
196 - allpredecessors
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
197 - allprecursors (deprecated, use allpredecessors instead)
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
198 - successors
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
199 - allsuccessors
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
200
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
201 Note that successors revset in evolve is not the same as successors revset in
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
202 core Mercurial 4.3+. In evolve this revset returns only immediate successors,
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
203 as opposed to all successors. Use "allsuccessors(set)" to obtain all
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
204 successors.
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
205
53dbe425d249 evolve: document provided revset predicates
Anton Shestakov <av6@dwimlabs.net>
parents: 5807
diff changeset
206 See :hg:`help revsets -v` for more information.
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
207 """
2049
b81d3775006b evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2048
diff changeset
208
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
209 evolutionhelptext = b"""
1414
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
210 Obsolescence markers make it possible to mark changesets that have been
5372
1b5afe8bb26a evolve: fix a typo in help text
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents: 5330
diff changeset
211 deleted or superseded in a new version of the changeset.
1414
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 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
214 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
215 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
216 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
217 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
218 :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
219
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
220 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
221 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
222 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
223 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
224 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
225 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
226
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
227 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
228 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
229 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
230 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
231 of history concurrently.
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
232
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
233 Current feature status
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
234 ======================
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
235
1710
aec233d3cafd help: fix evolution help grammar
timeless@gmail.com
parents: 1709
diff changeset
236 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
237 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
238
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
239 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
240 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
241 via an extension).
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
242
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
243 Instability
4471
3caa4a459439 tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4464
diff changeset
244 ===========
2782
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
245
4471
3caa4a459439 tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4464
diff changeset
246 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
247
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
248 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
249
4471
3caa4a459439 tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4464
diff changeset
250 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
251 Divergence has two variants:
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
252
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
253 * 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
254 lead to different results.
2782
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
255
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
256 * 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
257 becomes public.
2782
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
258
4471
3caa4a459439 tests: use current instability names everywhere
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4464
diff changeset
259 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
260
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
261 [experimental]
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
262 evolution=createmarkers,allnewcommands,exchange
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
263
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
264 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
265
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
266 [experimental]
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
267 evolution=createmarkers,allnewcommands,allowunstable,exchange
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
268
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
269 or simply::
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
270
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
271 [experimental]
2bd0b0996cfb evolve: document the various instability/troubles
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2772
diff changeset
272 evolution=all
6075
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
273
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
274 To prevent users from creating content divergence, a check is performed by
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
275 default on the revisions being rewritten, and the operation is aborted if it
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
276 creates divergence. If users want to allow creating content divergent
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
277 changesets, this check can be turned off by setting the following config::
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
278
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
279 [experimental]
f49e5fa3ae0e evolve: add a help section for 'skip content-divergence check'
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6024
diff changeset
280 evolution.allowdivergence=True
5779
96ed73c5c6ca doc: remove .strip() for a docstring
Kyle Lippincott <spectral@google.com>
parents: 5778
diff changeset
281 """
1414
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
282
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
283 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
284
670
97ce1f801309 evolve: drop unused import
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 663
diff changeset
285 import mercurial
617
469befc27b26 detect incompatibility with future mercurial 2.5
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 616
diff changeset
286
1823
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
287 from mercurial import (
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
288 bookmarks as bookmarksmod,
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
289 cmdutil,
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
290 commands,
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
291 error,
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
292 help,
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
293 hg,
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
294 lock as lockmod,
5699
644286633371 evolve: import mercurial.node as nodemod
Anton Shestakov <av6@dwimlabs.net>
parents: 5697
diff changeset
295 node as nodemod,
5806
1ac158fae24e evolve: rearrange some imports
Anton Shestakov <av6@dwimlabs.net>
parents: 5805
diff changeset
296 obsolete,
4761
2c3fd1bb2752 py3: store to __doc__ as str (unicode on py3)
Martin von Zweigbergk <martinvonz@google.com>
parents: 4749
diff changeset
297 pycompat,
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
298 registrar,
5806
1ac158fae24e evolve: rearrange some imports
Anton Shestakov <av6@dwimlabs.net>
parents: 5805
diff changeset
299 util,
1823
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
300 )
649d7a574c3f evolve: cleanup imports
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1822
diff changeset
301
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
302 from mercurial.i18n import _
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
303 from mercurial.node import nullid
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
304
2041
3b6550261614 exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2032
diff changeset
305 from . import (
2525
5adb8bdb935e compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents: 2524
diff changeset
306 compat,
2123
cf7b4ab31f0c split: move the debugcommand into a dedicated module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2122
diff changeset
307 debugcmd,
2772
394b836e475b commands: rewrite the 'evocommands' module to 'cmdrewrite'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2766
diff changeset
308 cmdrewrite,
3457
82e9f9603b1b evolvestate: rename the file to state.py and class name to cmdstate
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3456
diff changeset
309 state,
3461
6475d2046f87 evolvecmd: introduce a new module to handle `hg evolve` related code
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3460
diff changeset
310 evolvecmd,
2041
3b6550261614 exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2032
diff changeset
311 exthelper,
5223
11c359b4071d head-checking: backport fix from 7d5455b988ec
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5052
diff changeset
312 headchecking,
2049
b81d3775006b evolve: move extension metadata in their own module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2048
diff changeset
313 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
314 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
315 obsexchange,
4644
b228672b0ff9 obshashtree: move obshashtree in its own module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4624
diff changeset
316 obshashtree,
2524
d912380ec685 evolve: fix import order
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2521
diff changeset
317 obshistory,
5807
837b9fee065e evolve: split revsets into its own separate revset.py
Anton Shestakov <av6@dwimlabs.net>
parents: 5806
diff changeset
318 revset,
3858
bb4f5ad63877 rewind: add a proto version of the command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3839
diff changeset
319 rewind,
2524
d912380ec685 evolve: fix import order
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2521
diff changeset
320 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
321 utility,
2041
3b6550261614 exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2032
diff changeset
322 )
3b6550261614 exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2032
diff changeset
323
3373
3ff0da45d4c7 evolve: use compat.TROUBLES to show troubles in user interface
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3369
diff changeset
324 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
325 __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
326 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
327 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
328 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
329
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
330 # Flags for enabling optional parts of evolve
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
331 commandopt = b'allnewcommands'
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
332
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
333 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
334 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
335
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
336 colortable = {b'evolve.node': b'yellow',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
337 b'evolve.user': b'green',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
338 b'evolve.rev': b'blue',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
339 b'evolve.short_description': b'',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
340 b'evolve.date': b'cyan',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
341 b'evolve.current_rev': b'bold',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
342 b'evolve.verb': b'',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
343 b'evolve.operation': b'bold'
2337
c0ed4adf965e obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
344 }
c0ed4adf965e obshistory: add some color
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
345
4720
d48b689ea78a py3: make `import hgext3rd.evolve` work
Martin von Zweigbergk <martinvonz@google.com>
parents: 4717
diff changeset
346 aliases, entry = cmdutil.findcmd(b'commit', commands.table)
2724
e6bc6eaa17c5 amend: extract into a 'evolve.evocommands' module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2716
diff changeset
347
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
348 # This extension contains the following code
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
349 #
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
350 # - Extension Helper code
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
351 # - Obsolescence cache
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
352 # - ...
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
353 # - Older format compat
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
354
2041
3b6550261614 exthelper: extract into its own submodule
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2032
diff changeset
355 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
356 eh.merge(debugcmd.eh)
3470
ece5cd58147d evolve: move the evolve command to evolvecmd.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3469
diff changeset
357 eh.merge(evolvecmd.eh)
2053
f3765c4a352a exchange: rename the module
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2051
diff changeset
358 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
359 eh.merge(obshashtree.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
360 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
361 eh.merge(obshistory.eh)
2485
e6ecd35e99ec refactor: extract templates into a new file
Boris Feld <boris.feld@octobus.net>
parents: 2481
diff changeset
362 eh.merge(templatekw.eh)
2525
5adb8bdb935e compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents: 2524
diff changeset
363 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
364 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
365 eh.merge(rewind.eh)
5223
11c359b4071d head-checking: backport fix from 7d5455b988ec
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5052
diff changeset
366 eh.merge(headchecking.eh)
5807
837b9fee065e evolve: split revsets into its own separate revset.py
Anton Shestakov <av6@dwimlabs.net>
parents: 5806
diff changeset
367 eh.merge(revset.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
368 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
369 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
370 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
371 cmdtable = eh.cmdtable
3080
461c9d940519 evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents: 3074
diff changeset
372 configtable = eh.configtable
5807
837b9fee065e evolve: split revsets into its own separate revset.py
Anton Shestakov <av6@dwimlabs.net>
parents: 5806
diff changeset
373 templatekeyword = eh.templatekeyword
4328
392f1a6a0763 exthelper: simplify the ability to register revsets
Matt Harbison <matt_harbison@yahoo.com>
parents: 4324
diff changeset
374 revsetpredicate = eh.revsetpredicate
3080
461c9d940519 evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents: 3074
diff changeset
375
461c9d940519 evolve: registed configitems if available
Boris Feld <boris.feld@octobus.net>
parents: 3074
diff changeset
376 # Configuration
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
377 eh.configitem(b'experimental', b'evolutioncommands', [])
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
378 eh.configitem(b'experimental', b'evolution.allnewcommands', None)
5784
43a5371fa669 divergence-resolution: add support and doc for a special case in divergence
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5780
diff changeset
379 eh.configitem(b'experimental', b'evolution.divergence-resolution-minimal', False)
5777
c5dfbbe4363d evolve: when relocating, optionally first try to do it using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5700
diff changeset
380 eh.configitem(b'experimental', b'evolution.in-memory', b'false')
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
381
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
382 #####################################################################
1213
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
383 ### Option configuration ###
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
384 #####################################################################
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
385
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
386 @eh.reposetup # must be the first of its kin.
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
387 def _configureoptions(ui, repo):
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
388 # If no capabilities are specified, enable everything.
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
389 # This is so existing evolve users don't need to change their config.
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
390 evolveopts = repo.ui.configlist(b'experimental', b'evolution')
1213
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
391 if not evolveopts:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
392 evolveopts = [b'all']
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
393 repo.ui.setconfig(b'experimental', b'evolution', evolveopts, b'evolve')
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
394 if obsolete.isenabled(repo, b'exchange'):
3510
3bd642f11313 legacy: respect explicit config for server.bundle1
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3483
diff changeset
395 # if no config explicitly set, disable bundle1
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
396 if not isinstance(repo.ui.config(b'server', b'bundle1'), bytes):
5534
1ee535d769db config: specify the extension when forcing a config option
Matt Harbison <matt_harbison@yahoo.com>
parents: 5372
diff changeset
397 repo.ui.setconfig(b'server', b'bundle1', False, b'evolve')
1213
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
398
3365
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
399 class trdescrepo(repo.__class__):
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
400
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
401 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
402 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
403 tr.desc = desc
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
404 return tr
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
405
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
406 repo.__class__ = trdescrepo
911c91ce686f caches: record 'desc' attribute on transaction
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3298
diff changeset
407
1226
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
408 @eh.uisetup
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
409 def _configurecmdoptions(ui):
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
410 # Unregister evolve commands if the command capability is not specified.
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
411 #
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
412 # 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
413 # guarantee it happens after the above configuration, but before the
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
414 # extsetup functions.
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
415 evolvecommands = ui.configlist(b'experimental', b'evolutioncommands')
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
416 evolveopts = ui.configlist(b'experimental', b'evolution')
4235
e30119dfd626 style: fix various flake8 warning
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4184
diff changeset
417 if evolveopts and (commandopt not in evolveopts
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
418 and b'all' not in evolveopts):
1441
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
419 # 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
420 whitelist = set()
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
421 for cmd in evolvecommands:
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
422 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
423 if not matchingevolvecommands:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
424 raise error.Abort(_(b'unknown command: %s') % cmd)
1441
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
425 elif len(matchingevolvecommands) > 1:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
426 matchstr = b', '.join(matchingevolvecommands)
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
427 msg = _(b"ambiguous command specification: '%s' matches [%s]")
4749
cdafbd01d0bf py3: avoid "%r" for list of byte strings, which produces b'' on py3
Martin von Zweigbergk <martinvonz@google.com>
parents: 4747
diff changeset
428 raise error.Abort(msg % (cmd, matchstr))
1441
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
429 else:
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
430 whitelist.add(matchingevolvecommands[0])
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
431 for disabledcmd in set(cmdtable) - whitelist:
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1440
diff changeset
432 del cmdtable[disabledcmd]
1213
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
433
7118996bdf43 config: enable all obsolete options
Durham Goode <durham@fb.com>
parents: 1212
diff changeset
434 #####################################################################
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
435 ### Additional Utilities ###
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
436 #####################################################################
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
437
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
438 # 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
439
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
440 # - Function to create markers
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
441 # - 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
442 # - "troubles" method on changectx
1661
48232457b704 Spelling: through
timeless@gmail.com
parents: 1659
diff changeset
443 # - 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
444 # - function to find useful changeset to stabilize
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
445
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
446
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
447 ### Useful alias
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 @eh.uisetup
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
450 def setupparentcommand(ui):
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
451
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
452 _alias, statuscmd = cmdutil.findcmd(b'status', commands.table)
5791
2e1747baf550 pstatus: drop unnecessary CLI options
Anton Shestakov <av6@dwimlabs.net>
parents: 5790
diff changeset
453 inapplicable = {b'rev', b'change'}
2e1747baf550 pstatus: drop unnecessary CLI options
Anton Shestakov <av6@dwimlabs.net>
parents: 5790
diff changeset
454 pstatusopts = [o for o in statuscmd[1] if o[1] not in inapplicable]
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
455
4894
f9743b13de6d help: categorizing evolve and topic commands
Rodrigo Damazio <rdamazio@google.com>
parents: 4814
diff changeset
456 @eh.command(b'pstatus', pstatusopts,
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
457 helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY)
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
458 def pstatus(ui, repo, *args, **kwargs):
5700
15534a82f2cb evolve: typo in pstatus and pdiff docstring
Anton Shestakov <av6@dwimlabs.net>
parents: 5699
diff changeset
459 """show status combining committed and uncommitted changes
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
460
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
461 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
462 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
463 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
464
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
465 See :hg:`help status` for details."""
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
466 kwargs['rev'] = [b'.^']
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
467 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
468
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
469 _alias, diffcmd = cmdutil.findcmd(b'diff', commands.table)
5790
b1d1903df29e pdiff: drop unnecessary CLI options
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5784
diff changeset
470 inapplicable = {b'rev', b'from', b'to', b'change'}
b1d1903df29e pdiff: drop unnecessary CLI options
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 5784
diff changeset
471 pdiffopts = [o for o in diffcmd[1] if o[1] not in inapplicable]
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
472
4894
f9743b13de6d help: categorizing evolve and topic commands
Rodrigo Damazio <rdamazio@google.com>
parents: 4814
diff changeset
473 @eh.command(b'pdiff', pdiffopts,
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
474 helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY)
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
475 def pdiff(ui, repo, *args, **kwargs):
5700
15534a82f2cb evolve: typo in pstatus and pdiff docstring
Anton Shestakov <av6@dwimlabs.net>
parents: 5699
diff changeset
476 """show diff combining committed and uncommitted changes
2953
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 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
479 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
480 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
481
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
482 See :hg:`help diff` for details."""
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
483 kwargs['rev'] = [b'.^']
2953
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
484 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
485
b9aea9e48203 commands: upgrade pdiff and pstatus to full commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2952
diff changeset
486 @eh.uisetup
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
487 def _installalias(ui):
6484
f06ba91ae68e evolve: add obsdiff as alternative for odiff
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 6452
diff changeset
488 odiffalias = b"diff --hidden --rev 'limit(predecessors(.),1)' --rev ."
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
489 if ui.config(b'alias', b'odiff', None) is None:
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
490 ui.setconfig(b'alias', b'odiff',
6484
f06ba91ae68e evolve: add obsdiff as alternative for odiff
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 6452
diff changeset
491 odiffalias,
f06ba91ae68e evolve: add obsdiff as alternative for odiff
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 6452
diff changeset
492 b'evolve')
f06ba91ae68e evolve: add obsdiff as alternative for odiff
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 6452
diff changeset
493 if ui.config(b'alias', b'obsdiff', None) is None:
f06ba91ae68e evolve: add obsdiff as alternative for odiff
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 6452
diff changeset
494 ui.setconfig(b'alias', b'obsdiff',
f06ba91ae68e evolve: add obsdiff as alternative for odiff
Mathias De Mare <mathias.de_mare@nokia.com>
parents: 6452
diff changeset
495 odiffalias,
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
496 b'evolve')
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
497
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
498 #####################################################################
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
499 ### Various trouble warning ###
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
500 #####################################################################
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
501
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
502 # 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
503
3363
380fa6e8baf2 evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3362
diff changeset
504 def _warnobsoletewc(ui, repo, prevnode=None, wasobs=None):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
505 rev = repo[b'.']
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
506
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
507 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
508 return
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
509
3363
380fa6e8baf2 evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3362
diff changeset
510 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
511 return
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
512 msg = _(b"working directory parent is obsolete! (%s)\n")
5699
644286633371 evolve: import mercurial.node as nodemod
Anton Shestakov <av6@dwimlabs.net>
parents: 5697
diff changeset
513 shortnode = nodemod.short(rev.node())
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
514
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
515 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
516
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
517 # Check that evolve is activated for performance reasons
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
518 evolvecommandenabled = any(b'evolve' in e for e in cmdtable)
3455
f7ecb11d71bb update: show "use 'hg evolve' to..." hint iff evolve command enabled
Martin von Zweigbergk <martinvonz@google.com>
parents: 3427
diff changeset
519 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
520 return
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
521
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
522 # 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
523 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
524
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
525 if reason == b'pruned':
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
526 solvemsg = _(b"use 'hg evolve' to update to its parent successor")
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
527 elif reason == b'diverged':
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
528 debugcommand = b"hg evolve --list --content-divergent"
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
529 basemsg = _(b"%s has diverged, use '%s' to resolve the issue")
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
530 solvemsg = basemsg % (shortnode, debugcommand)
5052
b9a7fb0a0a49 evolve: use obsutil._getobsfate() directly
Anton Shestakov <av6@dwimlabs.net>
parents: 5040
diff changeset
531 elif reason == b'superseded':
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
532 msg = _(b"use 'hg evolve' to update to its successor: %s")
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
533 solvemsg = msg % successors[0]
5052
b9a7fb0a0a49 evolve: use obsutil._getobsfate() directly
Anton Shestakov <av6@dwimlabs.net>
parents: 5040
diff changeset
534 elif reason == b'superseded_split':
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
535 msg = _(b"use 'hg evolve' to update to its tipmost successor: %s")
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
536
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
537 if len(successors) <= 2:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
538 solvemsg = msg % b", ".join(successors)
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
539 else:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
540 firstsuccessors = b", ".join(successors[:2])
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
541 remainingnumber = len(successors) - 2
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
542 successorsmsg = _(b"%s and %d more") % (firstsuccessors, remainingnumber)
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
543 solvemsg = msg % successorsmsg
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
544 else:
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
545 raise ValueError(reason)
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 2286
diff changeset
546
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
547 ui.warn(b"(%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
548
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
549 @eh.wrapcommand(b"update")
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
550 @eh.wrapcommand(b"pull")
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
551 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts):
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
552 """Warn that the working directory parent is an obsolete changeset"""
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
553 ctx = repo[b'.']
3363
380fa6e8baf2 evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3362
diff changeset
554 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
555 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
556
4981
60be1bd580c7 compat: accept "success" argument to lock._afterlock callback
Martin von Zweigbergk <martinvonz@google.com>
parents: 4957
diff changeset
557 def warnobsolete(*args):
3363
380fa6e8baf2 evolve: don't show working directory obsolete message if we were on it
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3362
diff changeset
558 _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
559 wlock = None
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
560 try:
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
561 wlock = repo.wlock()
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
562 repo._afterlock(warnobsolete)
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
563 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
564 finally:
1bcbd14cf159 merge back with 3.3 compat branch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1451
diff changeset
565 lockmod.release(wlock)
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
566 return res
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
567
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
568 @eh.wrapcommand(b"parents")
1527
e080d2ae2656 parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1519
diff changeset
569 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
570 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
571 _warnobsoletewc(ui, repo)
e080d2ae2656 parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1519
diff changeset
572 return res
e080d2ae2656 parents: avoid locking the repository during 'hg parents'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1519
diff changeset
573
1122
c8750f4388c8 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents: 1120
diff changeset
574 @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
575 def push(orig, repo, *args, **opts):
492
7ecd41520dae rename `stabilize` to `evolve`
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 491
diff changeset
576 """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
577 """
1122
c8750f4388c8 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents: 1120
diff changeset
578 try:
c8750f4388c8 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents: 1120
diff changeset
579 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
580 except error.Abort as ex:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
581 hint = _(b"use 'hg evolve' to get a stable history "
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
582 b"or --force to ignore warnings")
1122
c8750f4388c8 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents: 1120
diff changeset
583 if (len(ex.args) >= 1
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
584 and ex.args[0].startswith(b'push includes ')
1122
c8750f4388c8 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents: 1120
diff changeset
585 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
586 ex.hint = hint
c8750f4388c8 evolve: wrap exchange.push() for compatability with core mercurial 4d52e6eb98ea
Matt Harbison <matt_harbison@yahoo.com>
parents: 1120
diff changeset
587 raise
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
588
788
e973dd5bf583 evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents: 776
diff changeset
589 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
590 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
591 if evolvestate:
1640
bbf897714e70 evolve: add --continue note to summary
timeless@gmail.com
parents: 1639
diff changeset
592 # i18n: column positioning for "hg summary"
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
593 ui.status(_(b'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
594
e973dd5bf583 evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents: 776
diff changeset
595 @eh.extsetup
e973dd5bf583 evolve: register a summary hook instead of wrapping the summary command
Simon Heimberg <simohe@besonet.ch>
parents: 776
diff changeset
596 def obssummarysetup(ui):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
597 cmdutil.summaryhooks.add(b'evolve', summaryhook)
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
598
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
599 #####################################################################
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
600 ### Old Evolve extension content ###
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
601 #####################################################################
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
602
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
603 ### new command
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
604 #############################
716
4c0f6d555032 prune: add --user and --date options
Levi Bard <levi@unity3d.com>
parents: 715
diff changeset
605
953
a02e5916a7e3 import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 952
diff changeset
606 @eh.uisetup
a02e5916a7e3 import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 952
diff changeset
607 def _installimportobsolete(ui):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
608 entry = cmdutil.findcmd(b'import', commands.table)[1]
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
609 entry[1].append((b'', b'obsolete', False,
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
610 _(b'mark the old node as obsoleted by '
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
611 b'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
612
3672
f4d5ef9ba074 import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3671
diff changeset
613 def _getnodefrompatch(patch, dest):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
614 patchnode = patch.get(b'nodeid')
3672
f4d5ef9ba074 import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3671
diff changeset
615 if patchnode is not None:
5699
644286633371 evolve: import mercurial.node as nodemod
Anton Shestakov <av6@dwimlabs.net>
parents: 5697
diff changeset
616 dest[b'node'] = nodemod.bin(patchnode)
3672
f4d5ef9ba074 import: grab the expected node value on the fly
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3671
diff changeset
617
953
a02e5916a7e3 import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 952
diff changeset
618 @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
619 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
620 expected = {b'node': None}
5186
4bac3454beef evolve: drop 4.5 compatibility for patch in tryimportone()
Anton Shestakov <av6@dwimlabs.net>
parents: 5181
diff changeset
621 _getnodefrompatch(hunk, expected)
4bac3454beef evolve: drop 4.5 compatibility for patch in tryimportone()
Anton Shestakov <av6@dwimlabs.net>
parents: 5181
diff changeset
622 ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
953
a02e5916a7e3 import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 952
diff changeset
623 created = ret[1]
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
624 if (opts[b'obsolete'] and None not in (created, expected[b'node'])
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
625 and created != expected[b'node']):
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
626 tr = repo.transaction(b'import-obs')
4449
4a00de50bb3b evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4342
diff changeset
627 try:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
628 metadata = {b'user': ui.username()}
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
629 repo.obsstore.create(tr, expected[b'node'], (created,),
4449
4a00de50bb3b evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4342
diff changeset
630 metadata=metadata)
4a00de50bb3b evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4342
diff changeset
631 tr.close()
4a00de50bb3b evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4342
diff changeset
632 finally:
4a00de50bb3b evolve: fix over-idented block
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4342
diff changeset
633 tr.release()
953
a02e5916a7e3 import: drop version check for ``import --obsolete``
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 952
diff changeset
634 return ret
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 927
diff changeset
635
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
636
894
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
637 def _deprecatealias(oldalias, newalias):
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
638 '''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
639
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
640 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
641 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
642 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
643 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
644 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
645
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
646 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
647 '''
1226
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
648 try:
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
649 aliases, entry = cmdutil.findcmd(newalias, cmdtable)
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
650 except error.UnknownCommand:
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
651 # Commands may be disabled
901d2f4b21a9 config: allow disabling commands
Durham Goode <durham@fb.com>
parents: 1221
diff changeset
652 return
1680
7caa5f2040c5 py3: use items() instead of iteritems()
timeless@gmail.com
parents: 1679
diff changeset
653 for alias, e in cmdtable.items():
894
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
654 if e is entry:
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
655 break
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
656
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
657 synopsis = b'(DEPRECATED)'
894
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
658 if len(entry) > 2:
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
659 fn, opts, _syn = entry
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
660 else:
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
661 fn, opts, = entry
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
662 deprecationwarning = _(b'%s have been deprecated in favor of %s\n') % (
1496
62aa11956a40 evolve: _() should not contain %
timeless@mozdev.org
parents: 1495
diff changeset
663 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
664
894
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
665 def newfn(*args, **kwargs):
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
666 ui = args[0]
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
667 ui.warn(deprecationwarning)
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
668 util.checksignature(fn)(*args, **kwargs)
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
669 newfn.__doc__ = pycompat.sysstr(deprecationwarning + b' (DEPRECATED)')
2043
c64300906a32 exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2041
diff changeset
670 cmdwrapper = eh.command(oldalias, opts, synopsis)
894
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
671 cmdwrapper(newfn)
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
672
895
17ac69db9329 evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents: 894
diff changeset
673 @eh.extsetup
17ac69db9329 evolve: deprecate gup and gdown aliases
Olle Lundberg <geek@nerd.sh>
parents: 894
diff changeset
674 def deprecatealiases(ui):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
675 _deprecatealias(b'gup', b'next')
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
676 _deprecatealias(b'gdown', b'previous')
894
4f21a3279a60 evolve: add function to deprecate an alias
Olle Lundberg <geek@nerd.sh>
parents: 890
diff changeset
677
2745
b38112b43a27 prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2743
diff changeset
678 def _gettopic(ctx):
b38112b43a27 prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2743
diff changeset
679 """handle topic fetching with or without the extension"""
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
680 return getattr(ctx, 'topic', lambda: b'')()
2745
b38112b43a27 prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2743
diff changeset
681
b38112b43a27 prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2743
diff changeset
682 def _gettopicidx(ctx):
b38112b43a27 prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2743
diff changeset
683 """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
684 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
685
2742
64fb1a082f58 prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2741
diff changeset
686 def _getcurrenttopic(repo):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
687 return getattr(repo, 'currenttopic', b'')
2742
64fb1a082f58 prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2741
diff changeset
688
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
689 def _prevupdate(repo, display, 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
690 if dryrun:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
691 repo.ui.write(_(b'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
692 if bookmark is not None:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
693 repo.ui.write(_(b'hg bookmark %s -r %s;\n')
3583
944a8c27d27b __init__: show some internationalization love
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3574
diff changeset
694 % (bookmark, target))
2736
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
695 else:
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
696 updatecheck = None
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
697 # --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
698 # config option
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
699 if mergeopt:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
700 updatecheck = b'none'
3784
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
701 try:
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
702 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
703 updatecheck=updatecheck)
3784
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
704 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
705 # replace the hint to mention about --merge option
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
706 exc.hint = _(b'do you want --merge?')
3784
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
707 raise
2736
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
708 if not ret:
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
709 tr = lock = None
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
710 try:
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
711 lock = repo.lock()
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
712 tr = repo.transaction(b'previous')
2736
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
713 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
714 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
715 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
716 else:
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
717 bookmarksmod.deactivate(repo)
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
718 tr.close()
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
719 finally:
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
720 lockmod.release(tr, lock)
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
721
3196
94e5235e95f5 evolve: make prev/next respect --quiet flag (issue5742)
Martin von Zweigbergk <martinvonz@google.com>
parents: 3185
diff changeset
722 if not repo.ui.quiet:
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
723 display(target)
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
724
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
725 def _findprevtarget(repo, display, movebookmark=False, topic=True):
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
726 target = bookmark = None
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
727 wkctx = repo[None]
5019
967e9a87e82d cleanup: replace .parents()[0] by .p1()
Martin von Zweigbergk <martinvonz@google.com>
parents: 5009
diff changeset
728 p1 = wkctx.p1()
2741
51d669b16fa8 prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2739
diff changeset
729 parents = p1.parents()
2742
64fb1a082f58 prev: add '_getcurrenttopic' helper and use it
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2741
diff changeset
730 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
731
b38112b43a27 prev: allow to update to 't0' from 't1'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2743
diff changeset
732 # 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
733 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
734 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
735 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
736 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
737
51d669b16fa8 prev: explicitly use 'p1' as a variable name
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2739
diff changeset
738 # issue message for the various case
5699
644286633371 evolve: import mercurial.node as nodemod
Anton Shestakov <av6@dwimlabs.net>
parents: 5697
diff changeset
739 if p1.node() == nullid:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
740 repo.ui.warn(_(b'already at repository root\n'))
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
741 elif not parents and currenttopic:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
742 repo.ui.warn(_(b'no parent in topic "%s"\n') % currenttopic)
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
743 repo.ui.warn(_(b'(do you want --no-topic)\n'))
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
744 elif len(parents) == 1:
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
745 target = parents[0]
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
746 bookmark = None
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
747 if movebookmark:
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
748 bookmark = repo._activebookmark
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
749 else:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
750 header = _(b"multiple parents, choose one to update:")
3551
ce346c6165c6 prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3550
diff changeset
751 prevs = [p.rev() for p in parents]
5879
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
752 selectedrev = utility.revselectionprompt(repo.ui, repo, prevs, header)
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
753 if selectedrev is None:
3551
ce346c6165c6 prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3550
diff changeset
754 for p in parents:
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
755 display(p)
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
756 repo.ui.warn(_(b'multiple parents, explicitly update to one\n'))
3551
ce346c6165c6 prev: prompt user to choose parent in case of multiple parents
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3550
diff changeset
757 else:
5879
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
758 target = repo[selectedrev]
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
759 return target, bookmark
2736
3c87d5276394 prev: extract the function performing the update
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2735
diff changeset
760
2043
c64300906a32 exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2041
diff changeset
761 @eh.command(
4715
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
762 b'previous',
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
763 [(b'B', b'move-bookmark', False,
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
764 _(b'move active bookmark after update')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
765 (b'm', b'merge', False, _(b'bring uncommitted change along')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
766 (b'', b'no-topic', False, _(b'ignore topic and move topologically')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
767 (b'n', b'dry-run', False,
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
768 _(b'do not perform actions, just print what would be done'))],
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
769 b'[OPTION]...',
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
770 helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY,
4894
f9743b13de6d help: categorizing evolve and topic commands
Rodrigo Damazio <rdamazio@google.com>
parents: 4814
diff changeset
771 helpbasic=True,
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
772 )
1160
e29a813f6af5 Make next/prev only move bookmarks optionally
Ryan McElroy <rmcelroy@fb.com>
parents: 1157
diff changeset
773 def cmdprevious(ui, repo, **opts):
1572
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
774 """update to parent revision
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
775
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
776 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
777 wlock = None
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
778 dryrunopt = opts['dry_run']
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
779 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
780 if not dryrunopt:
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
781 wlock = repo.wlock()
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
782 try:
1741
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
783 wkctx = repo[None]
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
784 wparents = wkctx.parents()
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
785 if len(wparents) != 1:
6332
58ba40d1f2c7 evolve: raise StateError when trying to prev/next from uncommitted merge
Anton Shestakov <av6@dwimlabs.net>
parents: 6308
diff changeset
786 raise compat.StateError(_(b'merge in progress'))
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
787 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
788 # we only skip the check if noconflict is set
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
789 if ui.config(b'commands', b'update.check') == b'noconflict':
3781
e73a73b27f3e prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3779
diff changeset
790 pass
e73a73b27f3e prev: respect `commands.update.check` config option in `hg prev` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3779
diff changeset
791 else:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
792 cmdutil.bailifchanged(repo, hint=_(b'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
793
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
794 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
795 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
796
3c28f8a3a5a5 prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4160
diff changeset
797 template = shorttemplate
3c28f8a3a5a5 prev: also use stack shortcut in output when possible
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4160
diff changeset
798 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
799 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
800
5697
4070b23cfef2 prevnext: respect command-templates.oneline-summary if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 5694
diff changeset
801 display = compat.format_changeset_summary_fn(ui, repo, b'previous',
4070b23cfef2 prevnext: respect command-templates.oneline-summary if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 5694
diff changeset
802 template)
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
803
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
804 target, bookmark = _findprevtarget(repo, display,
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
805 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
806 if target is not None:
5009
0ab3b94562ab evolve: use ui.configoverride() instead of ui.backupconfig()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4982
diff changeset
807 configoverride = util.nullcontextmanager()
0ab3b94562ab evolve: use ui.configoverride() instead of ui.backupconfig()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4982
diff changeset
808 if topic and _getcurrenttopic(repo) != _gettopic(target):
0ab3b94562ab evolve: use ui.configoverride() instead of ui.backupconfig()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4982
diff changeset
809 configoverride = repo.ui.configoverride({
0ab3b94562ab evolve: use ui.configoverride() instead of ui.backupconfig()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4982
diff changeset
810 (b'_internal', b'keep-topic'): b'yes'
6653
a93758f6f937 evolve: correct source for configoverride in hg previous
Anton Shestakov <av6@dwimlabs.net>
parents: 6558
diff changeset
811 }, source=b'previous')
5009
0ab3b94562ab evolve: use ui.configoverride() instead of ui.backupconfig()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4982
diff changeset
812 with configoverride:
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
813 _prevupdate(repo, display, target, bookmark, dryrunopt,
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
814 mergeopt)
2739
7d86594cb829 prev: extract the code computing the destination
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2738
diff changeset
815 return 0
1500
b4dfafda72c2 next: add support for --dry-run
timeless@mozdev.org
parents: 1499
diff changeset
816 else:
1741
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
817 return 1
1742
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
818 finally:
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
819 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
820
2043
c64300906a32 exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2041
diff changeset
821 @eh.command(
4715
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
822 b'next',
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
823 [(b'B', b'move-bookmark', False,
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
824 _(b'move active bookmark after update')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
825 (b'm', b'merge', False, _(b'bring uncommitted change along')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
826 (b'', b'evolve', True, _(b'evolve the next changeset if necessary')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
827 (b'', b'no-topic', False, _(b'ignore topic and move topologically')),
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
828 (b'n', b'dry-run', False,
5914
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
829 _(b'do not perform actions, just print what would be done')),
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
830 (b'', b'abort', False, _(b'abort the interrupted next'))],
4715
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
831 b'[OPTION]...',
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
832 helpcategory=registrar.command.CATEGORY_WORKING_DIRECTORY,
4894
f9743b13de6d help: categorizing evolve and topic commands
Rodrigo Damazio <rdamazio@google.com>
parents: 4814
diff changeset
833 helpbasic=True,
6308
1d5cb87fbce9 evolve: drop helpcategory 4.7 compat, use helpcategory keyword directly
Anton Shestakov <av6@dwimlabs.net>
parents: 6307
diff changeset
834 )
1160
e29a813f6af5 Make next/prev only move bookmarks optionally
Ryan McElroy <rmcelroy@fb.com>
parents: 1157
diff changeset
835 def cmdnext(ui, repo, **opts):
1572
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
836 """update to next child revision
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
837
4248
51b69f3dfc0b next: update the command description
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4247
diff changeset
838 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
839 behavior.
1572
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
840
44e9c0a264de evolve: improve help for prev, next commands
Greg Ward <greg@gerg.ca>
parents: 1571
diff changeset
841 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
842 """
1742
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
843 wlock = None
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
844 dryrunopt = opts['dry_run']
5914
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
845 abortopt = opts['abort']
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
846
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
847 compat.check_incompatible_arguments(opts, 'abort', ['move_bookmark', 'merge'])
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
848 if abortopt:
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
849 evolvestate = state.cmdstate(repo)
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
850 if not evolvestate:
6263
889d21445ee9 next: use compat.StateError for missing state file
Anton Shestakov <av6@dwimlabs.net>
parents: 6233
diff changeset
851 raise compat.StateError(_(b'no interrupted next to abort'))
5914
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
852
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
853 evolvestate.load()
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
854 if evolvestate[b'command'] != b'next':
6263
889d21445ee9 next: use compat.StateError for missing state file
Anton Shestakov <av6@dwimlabs.net>
parents: 6233
diff changeset
855 raise compat.StateError(_(b'no interrupted next to abort'))
5914
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
856
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
857 pctx = repo[b'.']
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
858 compat.clean_update(pctx)
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
859 ui.status(_(b'next aborted\n'))
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
860 ui.status(_(b'working directory is now at %s\n')
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
861 % ui.label(bytes(pctx), b'evolve.node'))
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
862 evolvestate.delete()
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
863 return 0
e8cc899a085a next: add an --abort flag
Anton Shestakov <av6@dwimlabs.net>
parents: 5910
diff changeset
864
1742
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
865 if not dryrunopt:
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
866 wlock = repo.wlock()
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
867 try:
1741
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
868 wkctx = repo[None]
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
869 wparents = wkctx.parents()
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
870 if len(wparents) != 1:
6332
58ba40d1f2c7 evolve: raise StateError when trying to prev/next from uncommitted merge
Anton Shestakov <av6@dwimlabs.net>
parents: 6308
diff changeset
871 raise compat.StateError(_(b'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
872
4233
efd542942d98 next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4184
diff changeset
873 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
874 topic = _getcurrenttopic(repo)
efd542942d98 next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4184
diff changeset
875 filtered = set()
efd542942d98 next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4184
diff changeset
876 template = shorttemplate
5882
1d8148795dc2 next: drop safety net around getting --no-topic flag value
Anton Shestakov <av6@dwimlabs.net>
parents: 5881
diff changeset
877 if topic and not opts['no_topic']:
5881
9a06d69d2ac7 next: make `filtered` a set of revs, not contexts
Anton Shestakov <av6@dwimlabs.net>
parents: 5880
diff changeset
878 filtered = set(ctx.rev() for ctx in children if ctx.topic() != topic)
9a06d69d2ac7 next: make `filtered` a set of revs, not contexts
Anton Shestakov <av6@dwimlabs.net>
parents: 5880
diff changeset
879 children = [ctx for ctx in children if ctx.rev() not in filtered]
4233
efd542942d98 next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4184
diff changeset
880 template = utility.stacktemplate
4342
914b9e55f76e next: populate stacktemplate to the missed _nextevolve function
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4329
diff changeset
881 opts['stacktemplate'] = True
5697
4070b23cfef2 prevnext: respect command-templates.oneline-summary if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 5694
diff changeset
882 display = compat.format_changeset_summary_fn(ui, repo, b'next',
4070b23cfef2 prevnext: respect command-templates.oneline-summary if configured
Martin von Zweigbergk <martinvonz@google.com>
parents: 5694
diff changeset
883 template)
4233
efd542942d98 next: move some code to prepare for `next --evolve` by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4184
diff changeset
884
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
885 # 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
886 needevolve = False
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
887 aspchildren = evolvecmd._aspiringchildren(repo, [repo[b'.'].rev()])
5883
24bfb5c7bf7a next: filter unstable targets by topic only when there's no --no-topic
Anton Shestakov <av6@dwimlabs.net>
parents: 5882
diff changeset
888 if topic and not opts['no_topic']:
5881
9a06d69d2ac7 next: make `filtered` a set of revs, not contexts
Anton Shestakov <av6@dwimlabs.net>
parents: 5880
diff changeset
889 filtered.update(rev for rev in aspchildren
5880
1ed3e1f2d2c3 next: make aspchildren filtering code work correctly
Anton Shestakov <av6@dwimlabs.net>
parents: 5879
diff changeset
890 if repo[rev].topic() != topic)
5881
9a06d69d2ac7 next: make `filtered` a set of revs, not contexts
Anton Shestakov <av6@dwimlabs.net>
parents: 5880
diff changeset
891 aspchildren = [rev for rev in aspchildren if rev not in filtered]
4252
a07cd1d076bb next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4250
diff changeset
892
5909
3571685e2aa2 next: remove duplicated targets when updating from an unstable changeset
Anton Shestakov <av6@dwimlabs.net>
parents: 5884
diff changeset
893 # Let's make sure we don't have any duplicates between children and
3571685e2aa2 next: remove duplicated targets when updating from an unstable changeset
Anton Shestakov <av6@dwimlabs.net>
parents: 5884
diff changeset
894 # aspiring children
3571685e2aa2 next: remove duplicated targets when updating from an unstable changeset
Anton Shestakov <av6@dwimlabs.net>
parents: 5884
diff changeset
895 filtered.update(ctx.rev() for ctx in children)
3571685e2aa2 next: remove duplicated targets when updating from an unstable changeset
Anton Shestakov <av6@dwimlabs.net>
parents: 5884
diff changeset
896 aspchildren = [rev for rev in aspchildren if rev not in filtered]
3571685e2aa2 next: remove duplicated targets when updating from an unstable changeset
Anton Shestakov <av6@dwimlabs.net>
parents: 5884
diff changeset
897
4252
a07cd1d076bb next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4250
diff changeset
898 # 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
899 # 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
900 # the aspiring children itself.
a07cd1d076bb next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4250
diff changeset
901 aspirants = set(aspchildren)
a07cd1d076bb next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4250
diff changeset
902 for aspchild in aspchildren:
a07cd1d076bb next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4250
diff changeset
903 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
904 if possdests & aspirants:
a07cd1d076bb next: solve the issue of `next` get confused by split
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4250
diff changeset
905 filtered.add(aspchild)
5881
9a06d69d2ac7 next: make `filtered` a set of revs, not contexts
Anton Shestakov <av6@dwimlabs.net>
parents: 5880
diff changeset
906 aspchildren = [rev for rev in aspchildren if rev not in filtered]
4247
820a25dcea58 next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4242
diff changeset
907 if aspchildren:
820a25dcea58 next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4242
diff changeset
908 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
909
4247
820a25dcea58 next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4242
diff changeset
910 # 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
911 if needevolve and opts['evolve']:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
912 hint = _(b'use `hg amend`, `hg revert` or `hg shelve`')
4247
820a25dcea58 next: make next command --evolve by default
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4242
diff changeset
913 cmdutil.bailifchanged(repo, hint=hint)
5917
94aed9c7ce69 next: refactor two if blocks into an if-elif block
Anton Shestakov <av6@dwimlabs.net>
parents: 5909
diff changeset
914 elif not opts['merge']:
3782
27cf636b2f4d next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3781
diff changeset
915 # we only skip the check if noconflict is set
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
916 if ui.config(b'commands', b'update.check') == b'noconflict':
3782
27cf636b2f4d next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3781
diff changeset
917 pass
27cf636b2f4d next: respect `commands.update.check` config option in `hg next` (issue5808)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3781
diff changeset
918 else:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
919 cmdutil.bailifchanged(repo, hint=_(b'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
920
5884
21a8f0336f26 next: treat targets that need evolution the same as regular targets
Anton Shestakov <av6@dwimlabs.net>
parents: 5883
diff changeset
921 if len(children) == 1 and (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
922 c = children[0]
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
923 return _updatetonext(ui, repo, c, display, opts)
1741
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
924 elif children:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
925 cheader = _(b"ambiguous next changeset, choose one to update:")
5884
21a8f0336f26 next: treat targets that need evolution the same as regular targets
Anton Shestakov <av6@dwimlabs.net>
parents: 5883
diff changeset
926 crevs = [c.rev() for c in children] + aspchildren
5879
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
927 selectedrev = utility.revselectionprompt(ui, repo, crevs, cheader)
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
928 if selectedrev is None:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
929 ui.warn(_(b"ambiguous next changeset:\n"))
5884
21a8f0336f26 next: treat targets that need evolution the same as regular targets
Anton Shestakov <av6@dwimlabs.net>
parents: 5883
diff changeset
930 for rev in crevs:
21a8f0336f26 next: treat targets that need evolution the same as regular targets
Anton Shestakov <av6@dwimlabs.net>
parents: 5883
diff changeset
931 display(repo[rev])
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
932 ui.warn(_(b"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
933 return 1
3547
78abffad8626 next: prompt user to choose a children in case of ambiguity
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3546
diff changeset
934 else:
6360
e959390490c2 branching: merge with stable
Anton Shestakov <av6@dwimlabs.net>
parents: 6332
diff changeset
935 if selectedrev in aspchildren:
e959390490c2 branching: merge with stable
Anton Shestakov <av6@dwimlabs.net>
parents: 6332
diff changeset
936 return _nextevolve(ui, repo, selectedrev, opts)
5879
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
937 return _updatetonext(ui, repo, repo[selectedrev], display, opts)
1500
b4dfafda72c2 next: add support for --dry-run
timeless@mozdev.org
parents: 1499
diff changeset
938 else:
4242
a07df2aa1b7d oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4241
diff changeset
939 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
940 if filtered:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
941 ui.warn(_(b'no children on topic "%s"\n') % topic)
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
942 ui.warn(_(b'do you want --no-topic\n'))
1741
8c05184672ae evolve: indent cmdnext and cmdprev ready for locking change (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1739
diff changeset
943 else:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
944 ui.warn(_(b'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
945 if aspchildren:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
946 msg = _(b'(%i unstable changesets to be evolved here, '
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
947 b'do you want --evolve?)\n')
4242
a07df2aa1b7d oops: backed out changeset df22f010cf24 pushed by error
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4241
diff changeset
948 ui.warn(msg % len(aspchildren))
3550
78d3ba4e17ac next: cleanup logic around return by returning early
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3549
diff changeset
949 return 1
4250
781d058d14f9 cleanup: avoid a Yoda condition
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4248
diff changeset
950 elif len(aspchildren) > 1:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
951 cheader = _(b"ambiguous next (unstable) changeset, choose one to"
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
952 b" evolve and update:")
5879
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
953 selectedrev = utility.revselectionprompt(ui, repo,
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
954 aspchildren, cheader)
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
955 if selectedrev is None:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
956 ui.warn(_(b"ambiguous next (unstable) changeset:\n"))
3549
802441114400 next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3548
diff changeset
957 for c in aspchildren:
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
958 display(repo[c])
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
959 ui.warn(_(b"(run 'hg evolve --rev REV' on one of them)\n"))
3549
802441114400 next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3548
diff changeset
960 return 1
802441114400 next: prompt user to choose child in ambiguity in `hg next --evolve`
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3548
diff changeset
961 else:
5879
cd344c0c89f0 evolve: rename choosedrev to selectedrev because choosed is not a word
Anton Shestakov <av6@dwimlabs.net>
parents: 5808
diff changeset
962 return _nextevolve(ui, repo, repo[selectedrev], 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
963 else:
3548
79d995cb8152 next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3547
diff changeset
964 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
965 finally:
970a4c13ebc3 evolve: lock the working copy early in next and prev (issue5244)
Simon Farnsworth <simonfar@fb.com>
parents: 1741
diff changeset
966 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
967
3548
79d995cb8152 next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3547
diff changeset
968 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
969 """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
970
79d995cb8152 next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3547
diff changeset
971 cmdutil.bailifchanged(repo)
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
972 evolvestate = state.cmdstate(repo, opts={b'command': b'next',
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
973 b'bookmarkchanges': []})
4609
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
974 with repo.wlock(), repo.lock():
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
975 tr = repo.transaction(b"evolve")
4609
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
976 with util.acceptintervention(tr):
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
977 result = evolvecmd._solveone(ui, repo, repo[aspchildren],
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
978 evolvestate, opts.get('dry_run'),
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
979 False,
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
980 lambda: None, category=b'orphan',
4609
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
981 stacktmplt=opts.get('stacktemplate',
fe2999627556 next: start transaction before calling _solveone()
Martin von Zweigbergk <martinvonz@google.com>
parents: 4489
diff changeset
982 False))
3548
79d995cb8152 next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3547
diff changeset
983 # 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
984 if result[0] and result[1]:
5778
84affb254cdf evolvecmd: don't update working copy when using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5777
diff changeset
985 # If using in-memory merge, _solveone() will not have updated the
84affb254cdf evolvecmd: don't update working copy when using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5777
diff changeset
986 # working copy, so we need to do that.
84affb254cdf evolvecmd: don't update working copy when using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5777
diff changeset
987 if evolvecmd.use_in_memory_merge(repo) and result[1]:
84affb254cdf evolvecmd: don't update working copy when using in-memory merge
Martin von Zweigbergk <martinvonz@google.com>
parents: 5777
diff changeset
988 compat.update(repo[result[1]])
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
989 ui.status(_(b'working directory is now at %s\n')
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
990 % ui.label(bytes(repo[b'.']), b'evolve.node'))
3548
79d995cb8152 next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3547
diff changeset
991 return 0
79d995cb8152 next: move logic to evolve the children to it's own function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3547
diff changeset
992
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
993 def _updatetonext(ui, repo, child, display, opts):
3539
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
994 """ 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
995 required """
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
996 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
997 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
998 if opts.get('dry_run'):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
999 ui.write(_(b'hg update %s;\n') % child)
3539
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1000 if shouldmove:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1001 ui.write(_(b'hg bookmark %s -r %s;\n') % (bm, child))
3539
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1002 else:
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
1003 updatecheck = None
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
1004 # --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
1005 # config option
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
1006 if opts['merge']:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1007 updatecheck = b'none'
3784
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
1008 try:
4732
4168c6b83406 evolve: rename variable "children" to "child" where it's clearly singular
Martin von Zweigbergk <martinvonz@google.com>
parents: 4731
diff changeset
1009 ret = hg.updatetotally(ui, repo, child.node(), None,
3813
27e7ed2d13a6 next-prev: always respect the --merge flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3784
diff changeset
1010 updatecheck=updatecheck)
3784
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
1011 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
1012 # replace the hint to mention about --merge option
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1013 exc.hint = _(b'do you want --merge?')
3784
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
1014 raise
838fc71ddb9c next-prev: replace the error hint to mention about `--merge` flag
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3782
diff changeset
1015
3539
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1016 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
1017 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
1018 try:
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1019 lock = repo.lock()
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1020 tr = repo.transaction(b'next')
3539
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1021 if shouldmove:
4732
4168c6b83406 evolve: rename variable "children" to "child" where it's clearly singular
Martin von Zweigbergk <martinvonz@google.com>
parents: 4731
diff changeset
1022 bmchanges = [(bm, child.node())]
3699
67d6cc7e0979 compat: drop compatibility layer for bookmark.applychanges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3694
diff changeset
1023 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
1024 else:
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1025 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
1026 tr.close()
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1027 finally:
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1028 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
1029 if not ui.quiet:
5694
bfdd8866f0b7 evolve: make the `displayer` we pass around just a function
Martin von Zweigbergk <martinvonz@google.com>
parents: 5671
diff changeset
1030 display(child)
3539
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1031 return 0
9bd64091e880 next: factor out the logic to update to changeset in another function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3535
diff changeset
1032
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1033 @eh.wrapcommand(b'commit')
116
64ca29eef349 Add a -o option to commit
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 113
diff changeset
1034 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
1035 tr = None
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
1036 if kwargs.get('amend', False):
1255
a2d4901e211e commit: avoid potential deadlock
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1253
diff changeset
1037 wlock = lock = None
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
1038 else:
1255
a2d4901e211e commit: avoid potential deadlock
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1253
diff changeset
1039 wlock = repo.wlock()
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
1040 lock = repo.lock()
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1041 try:
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1042 obsoleted = kwargs.get('obsolete', [])
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1043 if obsoleted:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1044 obsoleted = repo.set(b'%lr', obsoleted)
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1045 result = orig(ui, repo, *arg, **kwargs)
1659
c450d134aac4 Spelling: succeeded
timeless@gmail.com
parents: 1646
diff changeset
1046 if not result: # commit succeeded
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1047 new = repo[b'tip']
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1048 oldbookmarks = []
444
aedb6b8ace86 drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 443
diff changeset
1049 markers = []
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1050 for old in obsoleted:
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1051 oldbookmarks.extend(repo.nodebookmarks(old.node()))
444
aedb6b8ace86 drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 443
diff changeset
1052 markers.append((old, (new,)))
aedb6b8ace86 drop repo.addobsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 443
diff changeset
1053 if markers:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1054 obsolete.createmarkers(repo, markers, operation=b"amend")
2752
4457aa1d81aa compat: add a compatibility layer for bookmark move
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2748
diff changeset
1055 bmchanges = []
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1056 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
1057 bmchanges.append((book, new.node()))
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1058 if oldbookmarks:
1558
4706475e0c5d commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents: 1557
diff changeset
1059 if not wlock:
4706475e0c5d commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents: 1557
diff changeset
1060 wlock = repo.wlock()
4706475e0c5d commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents: 1557
diff changeset
1061 if not lock:
4706475e0c5d commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents: 1557
diff changeset
1062 lock = repo.lock()
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1063 tr = repo.transaction(b'commit')
3699
67d6cc7e0979 compat: drop compatibility layer for bookmark.applychanges
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3694
diff changeset
1064 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
1065 tr.close()
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1066 return result
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 133
diff changeset
1067 finally:
1558
4706475e0c5d commitwrapper: use bookmarks.recordchange instead of bookmarks.write
Laurent Charignon <lcharignon@fb.com>
parents: 1557
diff changeset
1068 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
1069
491
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
1070 @eh.extsetup
6989d8fe4ed2 merge evolve and obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 490
diff changeset
1071 def oldevolveextsetup(ui):
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1072 entry = cmdutil.findcmd(b'commit', commands.table)[1]
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1073 entry[1].append((b'o', b'obsolete', [],
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1074 _(b"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
1075
1302
ebcf23fe3032 evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1301
diff changeset
1076 @eh.wrapfunction(obsolete, '_checkinvalidmarkers')
5983
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1077 def _checkinvalidmarkers(orig, *args):
1302
ebcf23fe3032 evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1301
diff changeset
1078 """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
1079
ebcf23fe3032 evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1301
diff changeset
1080 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
1081 subtle handling.
ebcf23fe3032 evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1301
diff changeset
1082 """
5983
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1083 if len(args) == 2:
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1084 repo_nullid = args[0].nullid
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1085 markers = args[1]
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1086 else:
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1087 # hg <= 5.8 (d55b71393907)
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1088 repo_nullid = nullid
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1089 markers = args[0]
4804
079dbf36e884 python3: add raw prefix in cases harder to analyze at the token level
Raphaël Gomès <rgomes@octobus.net>
parents: 4803
diff changeset
1090 if r'debugobsconvert' in sys.argv:
1302
ebcf23fe3032 evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1301
diff changeset
1091 return
ebcf23fe3032 evolve: stop conditional wrapping of _checkinvalidmarkers
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1301
diff changeset
1092 for mark in markers:
5983
bfa47d370b2c compat: make compatible with upstream change to put nullid on repo
Martin von Zweigbergk <martinvonz@google.com>
parents: 5917
diff changeset
1093 if repo_nullid in mark[1]:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1094 msg = _(b'bad obsolescence marker detected: invalid successors nullid')
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1095 hint = _(b'You should run `hg debugobsconvert`')
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
1096 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
1097
2043
c64300906a32 exthelper: move command declaration into the exthelper
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2041
diff changeset
1098 @eh.command(
4715
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
1099 b'debugobsconvert',
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
1100 [(b'', b'new-format', obsexchange._bestformat, _(b'Destination format for markers.'))],
12c8b24757f4 py3: use byte strings for @command registrations
Martin von Zweigbergk <martinvonz@google.com>
parents: 4706
diff changeset
1101 b'')
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents: 1157
diff changeset
1102 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
1103 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
1104 if new_format == repo.obsstore._version:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1105 msg = _(b'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
1106 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
1107 with repo.lock():
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1108 f = repo.svfs(b'obsstore', b'wb', atomictemp=True)
2748
723f5b505c48 debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2745
diff changeset
1109 known = set()
723f5b505c48 debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2745
diff changeset
1110 markers = []
723f5b505c48 debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2745
diff changeset
1111 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
1112 # 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
1113 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
1114 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
1115 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
1116 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
1117 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
1118 continue
723f5b505c48 debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2745
diff changeset
1119 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
1120 markers.append(m)
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1121 ui.write(_(b'Old store is version %d, will rewrite in version %d\n') % (
2748
723f5b505c48 debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2745
diff changeset
1122 repo.obsstore._version, new_format))
4740
f8ef6d5f56f2 py3: don't depend on map() iterating over its input
Martin von Zweigbergk <martinvonz@google.com>
parents: 4732
diff changeset
1123 for data in obsolete.encodemarkers(markers, True, new_format):
f8ef6d5f56f2 py3: don't depend on map() iterating over its input
Martin von Zweigbergk <martinvonz@google.com>
parents: 4732
diff changeset
1124 f.write(data)
2748
723f5b505c48 debugobsconvert: take the lock when writing the obsstore file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2745
diff changeset
1125 f.close()
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1126 ui.write(_(b'Done!\n'))
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents: 1157
diff changeset
1127
864
401da1b38cca discovery: implement a discovery process and use it for push
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 863
diff changeset
1128
1827
15ec53d46f44 compat: drop handling of ancestral 'helploader' caller
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1826
diff changeset
1129 def _helploader(ui):
1414
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1130 return help.gettext(evolutionhelptext)
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1131
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1132 @eh.uisetup
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1133 def _setuphelp(ui):
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1134 for entry in help.helptable:
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1135 if entry[0] == b"evolution":
1414
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1136 break
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1137 else:
6307
554edfc7c55a evolve: remove 4.7 compatibility (help system)
Anton Shestakov <av6@dwimlabs.net>
parents: 6263
diff changeset
1138 help.helptable.append(([b"evolution"],
554edfc7c55a evolve: remove 4.7 compatibility (help system)
Anton Shestakov <av6@dwimlabs.net>
parents: 6263
diff changeset
1139 _(b"Safely Rewriting History"),
554edfc7c55a evolve: remove 4.7 compatibility (help system)
Anton Shestakov <av6@dwimlabs.net>
parents: 6263
diff changeset
1140 _helploader,
554edfc7c55a evolve: remove 4.7 compatibility (help system)
Anton Shestakov <av6@dwimlabs.net>
parents: 6263
diff changeset
1141 help.TOPIC_CATEGORY_CONCEPTS))
1414
4198e2fad6ba evolve: add an help topic about evolution
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1413
diff changeset
1142 help.helptable.sort()
1567
536fdfa3c48b evolve: extract logic to new method _relocatecommit
Shusen LIU <liushusen@fb.com>
parents: 1566
diff changeset
1143
1597
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1144 evolvestateversion = 0
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1145
3839
ac0717f23921 evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3836
diff changeset
1146 def _evolvemessage():
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1147 _msg = _(b'To continue: hg evolve --continue\n'
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1148 b'To abort: hg evolve --abort\n'
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1149 b'To stop: hg evolve --stop\n'
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1150 b'(also see `hg help evolve.interrupted`)')
3839
ac0717f23921 evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3836
diff changeset
1151 return cmdutil._commentlines(_msg)
ac0717f23921 evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3836
diff changeset
1152
6144
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1153 def _fixupmessage():
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1154 _msg = _(b'To continue: hg fixup --continue\n'
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1155 b'To abort: hg fixup --abort\n')
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1156 return cmdutil._commentlines(_msg)
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1157
1597
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1158 @eh.uisetup
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1159 def setupevolveunfinished(ui):
4700
6af77f89eac5 compat: fix `setupevolveunfinished` for upstream
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4697
diff changeset
1160 if not util.safehasattr(cmdutil, 'unfinishedstates'):
6af77f89eac5 compat: fix `setupevolveunfinished` for upstream
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4697
diff changeset
1161 from mercurial import state as statemod
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1162 _msg = _(b'To continue: hg evolve --continue\n'
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1163 b'To abort: hg evolve --abort\n'
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1164 b'To stop: hg evolve --stop\n'
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1165 b'(also see `hg help evolve.interrupted`)')
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1166 statemod.addunfinished(b'evolve', fname=b'evolvestate',
4700
6af77f89eac5 compat: fix `setupevolveunfinished` for upstream
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4697
diff changeset
1167 continueflag=True, stopflag=True,
4798
2e14a9386316 abort: added support for evolve to hg abort
Taapas Agrawal <taapas2897@gmail.com>
parents: 4774
diff changeset
1168 statushint=_msg,
6198
cc80747ef3c8 evolve: support hg continue
Luke Granger-Brown <hg@lukegb.com>
parents: 6191
diff changeset
1169 abortfunc=evolvecmd.hgabortevolve,
cc80747ef3c8 evolve: support hg continue
Luke Granger-Brown <hg@lukegb.com>
parents: 6191
diff changeset
1170 continuefunc=evolvecmd.hgcontinueevolve)
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1171 statemod.addunfinished(b'pick', fname=b'pickstate', continueflag=True,
6200
ceab1399302c pick: support hg continue
Luke Granger-Brown <hg@lukegb.com>
parents: 6198
diff changeset
1172 abortfunc=cmdrewrite.hgabortpick,
ceab1399302c pick: support hg continue
Luke Granger-Brown <hg@lukegb.com>
parents: 6198
diff changeset
1173 continuefunc=cmdrewrite.hgcontinuepick)
6130
cd07d6bd4e2a cmdrewrite: a new `hg fixup` command
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6075
diff changeset
1174 _fixup_msg = _(b'To continue: hg fixup --continue\n'
cd07d6bd4e2a cmdrewrite: a new `hg fixup` command
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 6075
diff changeset
1175 b'To abort: hg fixup --abort\n')
6143
11a3ec836a65 fixup: replace the underscore in state file name with a dash
Anton Shestakov <av6@dwimlabs.net>
parents: 6133
diff changeset
1176 statemod.addunfinished(b'fixup', fname=b'fixup-state',
6191
d2ec9ab1694e fixup: allow to be aborted using hg abort
Anton Shestakov <av6@dwimlabs.net>
parents: 6145
diff changeset
1177 continueflag=True, statushint=_fixup_msg,
6201
d18e16b9b793 fixup: support hg continue
Luke Granger-Brown <hg@lukegb.com>
parents: 6200
diff changeset
1178 abortfunc=cmdrewrite.hgabortfixup,
d18e16b9b793 fixup: support hg continue
Luke Granger-Brown <hg@lukegb.com>
parents: 6200
diff changeset
1179 continuefunc=cmdrewrite.hgcontinuefixup)
4700
6af77f89eac5 compat: fix `setupevolveunfinished` for upstream
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4697
diff changeset
1180 else:
5193
a4d081923c81 compat: update hg-X.Y compat comments and test them
Anton Shestakov <av6@dwimlabs.net>
parents: 5189
diff changeset
1181 # hg <= 5.0 (5f2f6912c9e6)
6627
5d6d1ce4905b evolve: make pytype ignore some old attributes present in Mercurial 5.0
Anton Shestakov <av6@dwimlabs.net>
parents: 6605
diff changeset
1182 # pytype: disable=module-attr
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1183 estate = (b'evolvestate', False, False, _(b'evolve in progress'),
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1184 _(b"use 'hg evolve --continue' or 'hg evolve --abort' to abort"))
4706
de194ed973ba branching: merge with stable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4700 4692
diff changeset
1185 cmdutil.unfinishedstates.append(estate)
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1186 pstate = (b'pickstate', False, False, _(b'pick in progress'),
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1187 _(b"use 'hg pick --continue' or 'hg pick --abort' to abort"))
4706
de194ed973ba branching: merge with stable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4700 4692
diff changeset
1188 cmdutil.unfinishedstates.append(pstate)
6144
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1189 fstate = (b'fixup-state', False, False, _(b'fixup in progress'),
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1190 _(b"use 'hg fixup --continue' or 'hg fixup --abort' to abort"))
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1191 cmdutil.unfinishedstates.append(fstate)
1597
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1192
4814
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1193 afterresolved = (b'evolvestate', _(b'hg evolve --continue'))
48b30ff742cb python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents: 4804
diff changeset
1194 pickresolved = (b'pickstate', _(b'hg pick --continue'))
6144
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1195 fixupresolved = (b'fixup-state', _(b'hg fixup --continue'))
4700
6af77f89eac5 compat: fix `setupevolveunfinished` for upstream
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4697
diff changeset
1196 cmdutil.afterresolvedstates.append(afterresolved)
6af77f89eac5 compat: fix `setupevolveunfinished` for upstream
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4697
diff changeset
1197 cmdutil.afterresolvedstates.append(pickresolved)
6144
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1198 cmdutil.afterresolvedstates.append(fixupresolved)
6627
5d6d1ce4905b evolve: make pytype ignore some old attributes present in Mercurial 5.0
Anton Shestakov <av6@dwimlabs.net>
parents: 6605
diff changeset
1199 # pytype: enable=module-attr
3472
05bd493d496d evolve: add evolve info to cmdutil.afterresolvedstates
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3470
diff changeset
1200
6145
1a20edff5cbd evolve: add a missing compatibility comment for cmdutil.STATES
Anton Shestakov <av6@dwimlabs.net>
parents: 6144
diff changeset
1201 # hg <= 5.0 (12243f15d53e)
3926
35172bd95e57 compat: ignore extra status feature for hg <= 4.3
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3870
diff changeset
1202 if util.safehasattr(cmdutil, 'STATES'):
6627
5d6d1ce4905b evolve: make pytype ignore some old attributes present in Mercurial 5.0
Anton Shestakov <av6@dwimlabs.net>
parents: 6605
diff changeset
1203 # pytype: disable=module-attr
6144
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1204 cmdutil.STATES = (
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1205 (b'evolve', cmdutil.fileexistspredicate(b'evolvestate'), _evolvemessage),
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1206 (b'fixup', cmdutil.fileexistspredicate(b'fixup-state'), _fixupmessage),
de82085e7f03 fixup: register state in older hg versions
Anton Shestakov <av6@dwimlabs.net>
parents: 6143
diff changeset
1207 ) + cmdutil.STATES
6627
5d6d1ce4905b evolve: make pytype ignore some old attributes present in Mercurial 5.0
Anton Shestakov <av6@dwimlabs.net>
parents: 6605
diff changeset
1208 # pytype: enable=module-attr
3839
ac0717f23921 evolve: show unfinished information in `hg status -v` (issue5886)
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3836
diff changeset
1209
1597
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1210 @eh.wrapfunction(hg, 'clean')
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1211 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
1212 ret = orig(repo, *args, **kwargs)
6202
fe8e88ea296d evolve: use util.unlinkpath() via vfs
Anton Shestakov <av6@dwimlabs.net>
parents: 6201
diff changeset
1213 repo.vfs.unlinkpath(b'evolvestate', ignoremissing=True)
1597
7876ed4fceb7 evolve: write our own custom evolvestate file
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1594
diff changeset
1214 return ret