annotate hgext3rd/evolve/__init__.py @ 6075:f49e5fa3ae0e stable

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