author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
Tue, 31 Jul 2012 14:26:41 +0200 | |
changeset 412 | 7d30d1becfc4 |
parent 411 | 4c1997e41d18 |
child 420 | b6163a85ddac |
permissions | -rw-r--r-- |
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
1 |
# obsolete.py - introduce the obsolete concept in mercurial. |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
2 |
# |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
3 |
# Copyright 2011 Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
4 |
# Logilab SA <contact@logilab.fr> |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
5 |
# |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
6 |
# This software may be used and distributed according to the terms of the |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
7 |
# GNU General Public License version 2 or any later version. |
69
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
8 |
"""Introduce the Obsolete concept to mercurial |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
9 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
10 |
General concept |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
11 |
=============== |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
12 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
13 |
This extension introduces the *obsolete* concept. It adds a new *obsolete* |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
14 |
relation between two changesets. A relation ``<changeset B> obsolete <changeset |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
15 |
A>`` is set to denote that ``<changeset B>`` is new version of ``<changeset |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
16 |
A>``. |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
17 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
18 |
The *obsolete* relation act as a **perpendicular history** to the standard |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
19 |
changeset history. Standard changeset history versions files. The *obsolete* |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
20 |
relation versions changesets. |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
21 |
|
228
5a17c0d41a00
proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
226
diff
changeset
|
22 |
:obsolete: a changeset that has been replaced by another one. |
5a17c0d41a00
proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
226
diff
changeset
|
23 |
:unstable: a changeset that is not obsolete but has an obsolete ancestor. |
85
531058dbd703
[obsolete] vocabulary update suggestion
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
84
diff
changeset
|
24 |
:suspended: an obsolete changeset with unstable descendant. |
228
5a17c0d41a00
proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
226
diff
changeset
|
25 |
:extinct: an obsolete changeset without unstable descendant. |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
26 |
(subject to garbage collection) |
85
531058dbd703
[obsolete] vocabulary update suggestion
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
84
diff
changeset
|
27 |
|
531058dbd703
[obsolete] vocabulary update suggestion
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
84
diff
changeset
|
28 |
Another name for unstable could be out of sync. |
69
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
29 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
30 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
31 |
Usage and Feature |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
32 |
================= |
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
33 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
34 |
|
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
35 |
New commands |
228
5a17c0d41a00
proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
226
diff
changeset
|
36 |
------------ |
69
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
37 |
|
275
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
38 |
Note that rebased changesets are not marked obsolete rather than being stripped |
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
39 |
In this experimental extensions, this is done forcing the --keep option. Trying |
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
40 |
to use the --keep option of rebase with this extensionn this experimental |
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
41 |
extension will cause such a call to abort. Until better releasen please use |
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
42 |
graft command to rebase and copy changesets. |
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
43 |
|
69
aee53d546849
[obsolete] update doc
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
58
diff
changeset
|
44 |
""" |
228
5a17c0d41a00
proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
226
diff
changeset
|
45 |
|
379
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
46 |
import os, sys |
54
ad1a4fb0fc49
Make states more resilient to missing head
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
53
diff
changeset
|
47 |
try: |
ad1a4fb0fc49
Make states more resilient to missing head
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
53
diff
changeset
|
48 |
from cStringIO import StringIO |
ad1a4fb0fc49
Make states more resilient to missing head
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
53
diff
changeset
|
49 |
except ImportError: |
ad1a4fb0fc49
Make states more resilient to missing head
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
53
diff
changeset
|
50 |
from StringIO import StringIO |
ad1a4fb0fc49
Make states more resilient to missing head
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
53
diff
changeset
|
51 |
|
75
d7b11772f0b5
[obsolete] published changeset can't be obsoleted
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
74
diff
changeset
|
52 |
from mercurial.i18n import _ |
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
53 |
|
224 | 54 |
import json |
89
757153438e58
[obsolet] base64 encore obsolete rel for pushkey
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
87
diff
changeset
|
55 |
|
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
56 |
import struct |
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
57 |
from mercurial import util, base85 |
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
58 |
|
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
59 |
_pack = struct.pack |
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
60 |
_unpack = struct.unpack |
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
61 |
|
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
62 |
from mercurial import util |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
63 |
from mercurial import context |
39 | 64 |
from mercurial import revset |
40
b9a5a596d9ef
proper computation of hidden changeset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
39
diff
changeset
|
65 |
from mercurial import scmutil |
42
eb6a06d7eae3
Make rebase set-obsolete relation
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
41
diff
changeset
|
66 |
from mercurial import extensions |
44
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
67 |
from mercurial import pushkey |
46
3b0364fc822f
Do not propagate obsolete changeset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
44
diff
changeset
|
68 |
from mercurial import discovery |
3b0364fc822f
Do not propagate obsolete changeset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
44
diff
changeset
|
69 |
from mercurial import error |
79
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
70 |
from mercurial import commands |
114
1a64195e2b09
nicer hiddenrevs init
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
112
diff
changeset
|
71 |
from mercurial import changelog |
115
d60eddda9546
add an option to ensure unstable are secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
114
diff
changeset
|
72 |
from mercurial import phases |
80
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
73 |
from mercurial.node import hex, bin, short, nullid |
52
62bdc2567099
Rollback support
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
51
diff
changeset
|
74 |
from mercurial.lock import release |
252
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
75 |
from mercurial import localrepo |
276
f26e9bc5f7fc
obsolete: use new-style command registration
Patrick Mezard <patrick@mezard.eu>
parents:
275
diff
changeset
|
76 |
from mercurial import cmdutil |
299
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
77 |
from mercurial import templatekw |
405
b5b1bf5166a2
obsolete: enable obsolete feature
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
399
diff
changeset
|
78 |
from mercurial import obsolete |
412
7d30d1becfc4
obsolete: simplify obsolete feature enabling
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
411
diff
changeset
|
79 |
obsolete._enabled = True |
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
80 |
|
160
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
81 |
try: |
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
82 |
from mercurial.localrepo import storecache |
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
83 |
storecache('babar') # to trigger import |
197
c2d692c8f599
stronger try except for store cache
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
160
diff
changeset
|
84 |
except (TypeError, ImportError): |
160
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
85 |
def storecache(*args): |
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
86 |
return scmutil.filecache(*args, instore=True) |
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
87 |
|
24346b78cd99
mercurial 2.1.2 compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
150
diff
changeset
|
88 |
|
72
774932a6cc0d
[obsolete] rationalize doc header.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
71
diff
changeset
|
89 |
### Patch changectx |
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
90 |
############################# |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
91 |
|
148
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
92 |
def unstable(ctx): |
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
93 |
"""is the changeset unstable (have obsolete ancestor)""" |
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
94 |
if ctx.node() is None: |
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
95 |
return False |
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
96 |
return ctx.rev() in ctx._repo._unstableset |
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
97 |
|
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
98 |
context.changectx.unstable = unstable |
8e93e1f67205
obsolete: define an unstable property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
144
diff
changeset
|
99 |
|
213
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
100 |
def extinct(ctx): |
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
101 |
"""is the changeset extinct by other""" |
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
102 |
if ctx.node() is None: |
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
103 |
return False |
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
104 |
return ctx.rev() in ctx._repo._extinctset |
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
105 |
|
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
106 |
context.changectx.extinct = extinct |
ea4aa1890b16
obsolete: add an extinct property on context
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
212
diff
changeset
|
107 |
|
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
108 |
def latecomer(ctx): |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
109 |
"""is the changeset latecomer (Try to succeed to public change)""" |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
110 |
if ctx.node() is None: |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
111 |
return False |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
112 |
return ctx.rev() in ctx._repo._latecomerset |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
113 |
|
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
114 |
context.changectx.latecomer = latecomer |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
115 |
|
354
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
116 |
def conflicting(ctx): |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
117 |
"""is the changeset conflicting (Try to succeed to public change)""" |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
118 |
if ctx.node() is None: |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
119 |
return False |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
120 |
return ctx.rev() in ctx._repo._conflictingset |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
121 |
|
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
122 |
context.changectx.conflicting = conflicting |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
123 |
|
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
124 |
|
72
774932a6cc0d
[obsolete] rationalize doc header.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
71
diff
changeset
|
125 |
### revset |
39 | 126 |
############################# |
127 |
||
321
41ba89f0caa5
obsolete: add an hidden revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
320
diff
changeset
|
128 |
def revsethidden(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
129 |
"""``hidden()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
130 |
Changeset is hidden. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
131 |
""" |
321
41ba89f0caa5
obsolete: add an hidden revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
320
diff
changeset
|
132 |
args = revset.getargs(x, 0, 0, 'hidden takes no argument') |
398
42828b0ace98
obsolete: fix hidden() revset
Patrick Mezard <patrick@mezard.eu>
parents:
397
diff
changeset
|
133 |
return [r for r in subset if r in repo.hiddenrevs] |
112
eae9be0ee00e
adapt obsolete to phase.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
109
diff
changeset
|
134 |
|
39 | 135 |
def revsetobsolete(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
136 |
"""``obsolete()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
137 |
Changeset is obsolete. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
138 |
""" |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
139 |
args = revset.getargs(x, 0, 0, 'obsolete takes no argument') |
252
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
140 |
return [r for r in subset if r in repo._obsoleteset and repo._phasecache.phase(repo, r) > 0] |
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
141 |
|
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
142 |
# XXX Backward compatibility, to be removed once stabilized |
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
143 |
if '_phasecache' not in vars(localrepo.localrepository): # new api |
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
144 |
def revsetobsolete(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
145 |
"""``obsolete()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
146 |
Changeset is obsolete. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
147 |
""" |
252
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
148 |
args = revset.getargs(x, 0, 0, 'obsolete takes no argument') |
470232cea503
[obsolete] fix new api: use the new phase cache api
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
228
diff
changeset
|
149 |
return [r for r in subset if r in repo._obsoleteset and repo._phaserev[r] > 0] |
39 | 150 |
|
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
151 |
def revsetunstable(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
152 |
"""``unstable()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
153 |
Unstable changesets are non-obsolete with obsolete ancestors. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
154 |
""" |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
155 |
args = revset.getargs(x, 0, 0, 'unstable takes no arguments') |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
156 |
return [r for r in subset if r in repo._unstableset] |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
157 |
|
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
158 |
def revsetsuspended(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
159 |
"""``suspended()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
160 |
Obsolete changesets with non-obsolete descendants. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
161 |
""" |
310
2d0dc5c18489
[obsolete] fix revset error message
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
308
diff
changeset
|
162 |
args = revset.getargs(x, 0, 0, 'suspended takes no arguments') |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
163 |
return [r for r in subset if r in repo._suspendedset] |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
164 |
|
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
165 |
def revsetextinct(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
166 |
"""``extinct()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
167 |
Obsolete changesets with obsolete descendants only. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
168 |
""" |
310
2d0dc5c18489
[obsolete] fix revset error message
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
308
diff
changeset
|
169 |
args = revset.getargs(x, 0, 0, 'extinct takes no arguments') |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
170 |
return [r for r in subset if r in repo._extinctset] |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
171 |
|
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
172 |
def revsetlatecomer(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
173 |
"""``latecomer()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
174 |
Changesets marked as successors of public changesets. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
175 |
""" |
310
2d0dc5c18489
[obsolete] fix revset error message
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
308
diff
changeset
|
176 |
args = revset.getargs(x, 0, 0, 'latecomer takes no arguments') |
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
177 |
return [r for r in subset if r in repo._latecomerset] |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
178 |
|
354
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
179 |
def revsetconflicting(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
180 |
"""``conflicting()`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
181 |
Changesets marked as successors of a same changeset. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
182 |
""" |
354
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
183 |
args = revset.getargs(x, 0, 0, 'conflicting takes no arguments') |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
184 |
return [r for r in subset if r in repo._conflictingset] |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
185 |
|
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
186 |
def _precursors(repo, s): |
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
187 |
"""Precursor of a changeset""" |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
188 |
cs = set() |
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
189 |
nm = repo.changelog.nodemap |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
190 |
markerbysubj = repo.obsstore.successors |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
191 |
for r in s: |
224 | 192 |
for p in markerbysubj.get(repo[r].node(), ()): |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
193 |
pr = nm.get(p[0]) |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
194 |
if pr is not None: |
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
195 |
cs.add(pr) |
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
196 |
return cs |
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
197 |
|
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
198 |
def revsetprecursors(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
199 |
"""``precursors(set)`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
200 |
Immediate precursors of changesets in set. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
201 |
""" |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
202 |
s = revset.getset(repo, range(len(repo)), x) |
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
203 |
cs = _precursors(repo, s) |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
204 |
return [r for r in subset if r in cs] |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
205 |
|
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
206 |
def _allprecursors(repo, s): # XXX we need a better naming |
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
207 |
"""transitive precursors of a subset""" |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
208 |
toproceed = [repo[r].node() for r in s] |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
209 |
seen = set() |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
210 |
allsubjects = repo.obsstore.successors |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
211 |
while toproceed: |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
212 |
nc = toproceed.pop() |
224 | 213 |
for mark in allsubjects.get(nc, ()): |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
214 |
np = mark[0] |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
215 |
if np not in seen: |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
216 |
seen.add(np) |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
217 |
toproceed.append(np) |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
218 |
nm = repo.changelog.nodemap |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
219 |
cs = set() |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
220 |
for p in seen: |
204
50039b9b535e
2.2 compat: nodemap.get take a single argument now.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
203
diff
changeset
|
221 |
pr = nm.get(p) |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
222 |
if pr is not None: |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
223 |
cs.add(pr) |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
224 |
return cs |
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
225 |
|
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
226 |
def revsetallprecursors(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
227 |
"""``allprecursors(set)`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
228 |
Transitive precursors of changesets in set. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
229 |
""" |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
230 |
s = revset.getset(repo, range(len(repo)), x) |
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
231 |
cs = _allprecursors(repo, s) |
143
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
232 |
return [r for r in subset if r in cs] |
0599fb01dc41
add an obsolete parent revset and related alias
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
135
diff
changeset
|
233 |
|
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
234 |
def _successors(repo, s): |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
235 |
"""Successors of a changeset""" |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
236 |
cs = set() |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
237 |
nm = repo.changelog.nodemap |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
238 |
markerbyobj = repo.obsstore.precursors |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
239 |
for r in s: |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
240 |
for p in markerbyobj.get(repo[r].node(), ()): |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
241 |
for sub in p[1]: |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
242 |
sr = nm.get(sub) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
243 |
if sr is not None: |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
244 |
cs.add(sr) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
245 |
return cs |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
246 |
|
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
247 |
def revsetsuccessors(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
248 |
"""``successors(set)`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
249 |
Immediate successors of changesets in set. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
250 |
""" |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
251 |
s = revset.getset(repo, range(len(repo)), x) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
252 |
cs = _successors(repo, s) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
253 |
return [r for r in subset if r in cs] |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
254 |
|
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
255 |
def _allsuccessors(repo, s): # XXX we need a better naming |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
256 |
"""transitive successors of a subset""" |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
257 |
toproceed = [repo[r].node() for r in s] |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
258 |
seen = set() |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
259 |
allobjects = repo.obsstore.precursors |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
260 |
while toproceed: |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
261 |
nc = toproceed.pop() |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
262 |
for mark in allobjects.get(nc, ()): |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
263 |
for sub in mark[1]: |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
264 |
if sub not in seen: |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
265 |
seen.add(sub) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
266 |
toproceed.append(sub) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
267 |
nm = repo.changelog.nodemap |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
268 |
cs = set() |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
269 |
for s in seen: |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
270 |
sr = nm.get(s) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
271 |
if sr is not None: |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
272 |
cs.add(sr) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
273 |
return cs |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
274 |
|
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
275 |
def revsetallsuccessors(repo, subset, x): |
397
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
276 |
"""``allsuccessors(set)`` |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
277 |
Transitive successors of changesets in set. |
0bd63f294a6f
obsolete: improve revset online help
Patrick Mezard <patrick@mezard.eu>
parents:
393
diff
changeset
|
278 |
""" |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
279 |
s = revset.getset(repo, range(len(repo)), x) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
280 |
cs = _allsuccessors(repo, s) |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
281 |
return [r for r in subset if r in cs] |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
282 |
|
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
283 |
|
299
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
284 |
### template keywords |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
285 |
##################### |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
286 |
|
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
287 |
def obsoletekw(repo, ctx, templ, **args): |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
288 |
""":obsolete: String. The obsolescence level of the node, could be |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
289 |
``stable``, ``unstable``, ``suspended`` or ``extinct``. |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
290 |
""" |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
291 |
rev = ctx.rev() |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
292 |
if rev in repo._extinctset: |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
293 |
return 'extinct' |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
294 |
if rev in repo._suspendedset: |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
295 |
return 'suspended' |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
296 |
if rev in repo._unstableset: |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
297 |
return 'unstable' |
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
298 |
return 'stable' |
144
f387658d6d22
Add a bosancestors revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
143
diff
changeset
|
299 |
|
71
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
300 |
### Other Extension compat |
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
301 |
############################ |
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
302 |
|
150
f12fd2410a60
obsolete: improve rebase compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
148
diff
changeset
|
303 |
|
253
8ee6c5b98d73
[obsolete] fix new api: be more flexible on rebase's buildstate signature
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
252
diff
changeset
|
304 |
def buildstate(orig, repo, dest, rebaseset, *ags, **kws): |
150
f12fd2410a60
obsolete: improve rebase compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
148
diff
changeset
|
305 |
"""wrapper for rebase 's buildstate that exclude obsolete changeset""" |
f12fd2410a60
obsolete: improve rebase compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
148
diff
changeset
|
306 |
rebaseset = repo.revs('%ld - extinct()', rebaseset) |
253
8ee6c5b98d73
[obsolete] fix new api: be more flexible on rebase's buildstate signature
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
252
diff
changeset
|
307 |
return orig(repo, dest, rebaseset, *ags, **kws) |
150
f12fd2410a60
obsolete: improve rebase compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
148
diff
changeset
|
308 |
|
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
309 |
def defineparents(orig, repo, rev, target, state, *args, **kwargs): |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
310 |
rebasestate = getattr(repo, '_rebasestate', None) |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
311 |
if rebasestate is not None: |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
312 |
repo._rebasestate = dict(state) |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
313 |
repo._rebasetarget = target |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
314 |
return orig(repo, rev, target, state, *args, **kwargs) |
150
f12fd2410a60
obsolete: improve rebase compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
148
diff
changeset
|
315 |
|
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
316 |
def concludenode(orig, repo, rev, p1, *args, **kwargs): |
74
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
317 |
"""wrapper for rebase 's concludenode that set obsolete relation""" |
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
318 |
newrev = orig(repo, rev, p1, *args, **kwargs) |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
319 |
rebasestate = getattr(repo, '_rebasestate', None) |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
320 |
if rebasestate is not None: |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
321 |
if newrev is not None: |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
322 |
nrev = repo[newrev].rev() |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
323 |
else: |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
324 |
nrev = p1 |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
325 |
repo._rebasestate[rev] = nrev |
71
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
326 |
return newrev |
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
327 |
|
274
6622a24f3b0f
obsolete: fix rebase wrapping
Patrick Mezard <patrick@mezard.eu>
parents:
273
diff
changeset
|
328 |
def cmdrebase(orig, ui, repo, *args, **kwargs): |
311
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
329 |
|
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
330 |
reallykeep = kwargs.get('keep', False) |
275
336210dada95
obsolete: make rebase abort with --keep
Patrick Mezard <patrick@mezard.eu>
parents:
274
diff
changeset
|
331 |
kwargs = dict(kwargs) |
84
c4cc5f3bcf12
[obsolete] rebase always keep changeset.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
83
diff
changeset
|
332 |
kwargs['keep'] = True |
c4cc5f3bcf12
[obsolete] rebase always keep changeset.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
83
diff
changeset
|
333 |
|
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
334 |
# We want to mark rebased revision as obsolete and set their |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
335 |
# replacements if any. Doing it in concludenode() prevents |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
336 |
# aborting the rebase, and is not called with all relevant |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
337 |
# revisions in --collapse case. Instead, we try to track the |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
338 |
# rebase state structure by sampling/updating it in |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
339 |
# defineparents() and concludenode(). The obsolete markers are |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
340 |
# added from this state after a successful call. |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
341 |
repo._rebasestate = {} |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
342 |
repo._rebasetarget = None |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
343 |
try: |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
344 |
res = orig(ui, repo, *args, **kwargs) |
311
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
345 |
if not reallykeep: |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
346 |
# Filter nullmerge or unrebased entries |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
347 |
repo._rebasestate = dict(p for p in repo._rebasestate.iteritems() |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
348 |
if p[1] >= 0) |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
349 |
if not res and not kwargs.get('abort') and repo._rebasestate: |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
350 |
# Rebased revisions are assumed to be descendants of |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
351 |
# targetrev. If a source revision is mapped to targetrev |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
352 |
# or to another rebased revision, it must have been |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
353 |
# removed. |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
354 |
targetrev = repo[repo._rebasetarget].rev() |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
355 |
newrevs = set([targetrev]) |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
356 |
replacements = {} |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
357 |
for rev, newrev in sorted(repo._rebasestate.items()): |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
358 |
oldnode = repo[rev].node() |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
359 |
if newrev not in newrevs: |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
360 |
newnode = repo[newrev].node() |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
361 |
newrevs.add(newrev) |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
362 |
else: |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
363 |
newnode = nullid |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
364 |
replacements[oldnode] = newnode |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
365 |
|
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
366 |
if kwargs.get('collapse'): |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
367 |
newnodes = set(n for n in replacements.values() if n != nullid) |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
368 |
if newnodes: |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
369 |
# Collapsing into more than one revision? |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
370 |
assert len(newnodes) == 1, newnodes |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
371 |
newnode = newnodes.pop() |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
372 |
else: |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
373 |
newnode = nullid |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
374 |
repo.addcollapsedobsolete(replacements, newnode) |
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
375 |
else: |
311
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
376 |
for oldnode, newnode in replacements.iteritems(): |
5eecfda0a5c7
obsolete: enable rebase --keep again
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
310
diff
changeset
|
377 |
repo.addobsolete(newnode, oldnode) |
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
378 |
return res |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
379 |
finally: |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
380 |
delattr(repo, '_rebasestate') |
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
381 |
delattr(repo, '_rebasetarget') |
84
c4cc5f3bcf12
[obsolete] rebase always keep changeset.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
83
diff
changeset
|
382 |
|
71
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
383 |
|
39 | 384 |
def extsetup(ui): |
75
d7b11772f0b5
[obsolete] published changeset can't be obsoleted
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
74
diff
changeset
|
385 |
|
321
41ba89f0caa5
obsolete: add an hidden revset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
320
diff
changeset
|
386 |
revset.symbols["hidden"] = revsethidden |
39 | 387 |
revset.symbols["obsolete"] = revsetobsolete |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
388 |
revset.symbols["unstable"] = revsetunstable |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
389 |
revset.symbols["suspended"] = revsetsuspended |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
390 |
revset.symbols["extinct"] = revsetextinct |
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
391 |
revset.symbols["latecomer"] = revsetlatecomer |
354
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
392 |
revset.symbols["conflicting"] = revsetconflicting |
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
393 |
revset.symbols["obsparents"] = revsetprecursors # DEPR |
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
394 |
revset.symbols["precursors"] = revsetprecursors |
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
395 |
revset.symbols["obsancestors"] = revsetallprecursors # DEPR |
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
396 |
revset.symbols["allprecursors"] = revsetallprecursors # bad name |
306
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
397 |
revset.symbols["successors"] = revsetsuccessors |
8cfa3163dfaa
obsolete: add precursors and successors revset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
305
diff
changeset
|
398 |
revset.symbols["allsuccessors"] = revsetallsuccessors # bad name |
46
3b0364fc822f
Do not propagate obsolete changeset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
44
diff
changeset
|
399 |
|
299
eda6491ca269
obsolete: add 'obsolete' keyword
Patrick Mezard <patrick@mezard.eu>
parents:
298
diff
changeset
|
400 |
templatekw.keywords['obsolete'] = obsoletekw |
46
3b0364fc822f
Do not propagate obsolete changeset
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
44
diff
changeset
|
401 |
|
356
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
402 |
# warning about more obsolete |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
403 |
for cmd in ['commit', 'push', 'pull', 'graft', 'phase', 'unbundle']: |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
404 |
entry = extensions.wrapcommand(commands.table, cmd, warnobserrors) |
42
eb6a06d7eae3
Make rebase set-obsolete relation
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
41
diff
changeset
|
405 |
try: |
eb6a06d7eae3
Make rebase set-obsolete relation
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
41
diff
changeset
|
406 |
rebase = extensions.find('rebase') |
eb6a06d7eae3
Make rebase set-obsolete relation
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
41
diff
changeset
|
407 |
if rebase: |
356
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
408 |
entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors) |
150
f12fd2410a60
obsolete: improve rebase compat
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
148
diff
changeset
|
409 |
extensions.wrapfunction(rebase, 'buildstate', buildstate) |
282
05ab164c6593
obsolete: handle rebase --collapse
Patrick Mezard <patrick@mezard.eu>
parents:
279
diff
changeset
|
410 |
extensions.wrapfunction(rebase, 'defineparents', defineparents) |
42
eb6a06d7eae3
Make rebase set-obsolete relation
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
41
diff
changeset
|
411 |
extensions.wrapfunction(rebase, 'concludenode', concludenode) |
84
c4cc5f3bcf12
[obsolete] rebase always keep changeset.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
83
diff
changeset
|
412 |
extensions.wrapcommand(rebase.cmdtable, "rebase", cmdrebase) |
42
eb6a06d7eae3
Make rebase set-obsolete relation
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
41
diff
changeset
|
413 |
except KeyError: |
305
0b444d7c5c96
update revset vocabulary to use precursors, successors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
304
diff
changeset
|
414 |
pass # rebase not found |
39 | 415 |
|
214
a140d1857931
obsolete: do not warn about unpushed extinct changeset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
213
diff
changeset
|
416 |
### Discovery wrapping |
a140d1857931
obsolete: do not warn about unpushed extinct changeset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
213
diff
changeset
|
417 |
############################# |
a140d1857931
obsolete: do not warn about unpushed extinct changeset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
213
diff
changeset
|
418 |
|
a140d1857931
obsolete: do not warn about unpushed extinct changeset.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
213
diff
changeset
|
419 |
|
217
786eb34d93ea
obsolete: refuse to push unstable changeset without -f
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
215
diff
changeset
|
420 |
def wrapcheckheads(orig, repo, remote, outgoing, *args, **kwargs): |
218
ace5608350b6
obsolete: do no complain when push create a new head but obsolete an old one.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
217
diff
changeset
|
421 |
"""wrap mercurial.discovery.checkheads |
ace5608350b6
obsolete: do no complain when push create a new head but obsolete an old one.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
217
diff
changeset
|
422 |
|
ace5608350b6
obsolete: do no complain when push create a new head but obsolete an old one.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
217
diff
changeset
|
423 |
* prevent unstability to be pushed |
ace5608350b6
obsolete: do no complain when push create a new head but obsolete an old one.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
217
diff
changeset
|
424 |
* patch remote to ignore obsolete heads on remote |
ace5608350b6
obsolete: do no complain when push create a new head but obsolete an old one.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
217
diff
changeset
|
425 |
""" |
ace5608350b6
obsolete: do no complain when push create a new head but obsolete an old one.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
217
diff
changeset
|
426 |
# do not push instability |
376
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
427 |
for h in outgoing.missingheads: |
390
54582eebeb08
obsolete: fix typos, improve messages
Patrick Mezard <patrick@mezard.eu>
parents:
388
diff
changeset
|
428 |
# Checking heads is enough, obsolete descendants are either |
54582eebeb08
obsolete: fix typos, improve messages
Patrick Mezard <patrick@mezard.eu>
parents:
388
diff
changeset
|
429 |
# obsolete or unstable. |
388
97b75bbfacc5
obsolete: rely on core for context and reveset which exist there
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
387
diff
changeset
|
430 |
ctx = repo[h] |
376
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
431 |
if ctx.latecomer(): |
390
54582eebeb08
obsolete: fix typos, improve messages
Patrick Mezard <patrick@mezard.eu>
parents:
388
diff
changeset
|
432 |
raise util.Abort(_("push includes a latecomer changeset: %s!") |
376
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
433 |
% ctx) |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
434 |
if ctx.conflicting(): |
390
54582eebeb08
obsolete: fix typos, improve messages
Patrick Mezard <patrick@mezard.eu>
parents:
388
diff
changeset
|
435 |
raise util.Abort(_("push includes a conflicting changeset: %s!") |
376
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
436 |
% ctx) |
382
58fdb2180064
Use the core check heads mecanism to prevent zaelous warning
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
381
diff
changeset
|
437 |
return orig(repo, remote, outgoing, *args, **kwargs) |
217
786eb34d93ea
obsolete: refuse to push unstable changeset without -f
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
215
diff
changeset
|
438 |
|
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
439 |
def wrapclearcache(orig, repo, *args, **kwargs): |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
440 |
try: |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
441 |
return orig(repo, *args, **kwargs) |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
442 |
finally: |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
443 |
repo._clearobsoletecache() |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
444 |
|
217
786eb34d93ea
obsolete: refuse to push unstable changeset without -f
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
215
diff
changeset
|
445 |
|
71
19e1930587a0
[obsolete] Move extension compat code
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
70
diff
changeset
|
446 |
### New commands |
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
447 |
############################# |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
448 |
|
276
f26e9bc5f7fc
obsolete: use new-style command registration
Patrick Mezard <patrick@mezard.eu>
parents:
275
diff
changeset
|
449 |
cmdtable = {} |
f26e9bc5f7fc
obsolete: use new-style command registration
Patrick Mezard <patrick@mezard.eu>
parents:
275
diff
changeset
|
450 |
command = cmdutil.command(cmdtable) |
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
451 |
|
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
452 |
|
276
f26e9bc5f7fc
obsolete: use new-style command registration
Patrick Mezard <patrick@mezard.eu>
parents:
275
diff
changeset
|
453 |
@command('debugconvertobsolete', [], '') |
224 | 454 |
def cmddebugconvertobsolete(ui, repo): |
278
fa0b9b8a83c0
obsolete: add or fix debug commands help
Patrick Mezard <patrick@mezard.eu>
parents:
277
diff
changeset
|
455 |
"""import markers from an .hg/obsolete-relations file""" |
224 | 456 |
cnt = 0 |
337
ebfd1b96a013
obsolete: convert try to guess what invalid node id are
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
336
diff
changeset
|
457 |
err = 0 |
224 | 458 |
l = repo.lock() |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
459 |
some = False |
224 | 460 |
try: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
461 |
unlink = [] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
462 |
tr = repo.transaction('convert-obsolete') |
224 | 463 |
try: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
464 |
repo._importoldobsolete = True |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
465 |
store = repo.obsstore |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
466 |
### very first format |
224 | 467 |
try: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
468 |
f = repo.opener('obsolete-relations') |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
469 |
try: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
470 |
some = True |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
471 |
for line in f: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
472 |
subhex, objhex = line.split() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
473 |
suc = bin(subhex) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
474 |
prec = bin(objhex) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
475 |
sucs = (suc==nullid) and [] or [suc] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
476 |
meta = { |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
477 |
'date': '%i %i' % util.makedate(), |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
478 |
'user': ui.username(), |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
479 |
} |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
480 |
try: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
481 |
store.create(tr, prec, sucs, 0, meta) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
482 |
cnt += 1 |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
483 |
except ValueError: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
484 |
repo.ui.write_err("invalid old marker line: %s" |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
485 |
% (line)) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
486 |
err += 1 |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
487 |
finally: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
488 |
f.close() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
489 |
unlink.append(repo.join('obsolete-relations')) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
490 |
except IOError: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
491 |
pass |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
492 |
### second (json) format |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
493 |
data = repo.sopener.tryread('obsoletemarkers') |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
494 |
if data: |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
495 |
some = True |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
496 |
for oldmark in json.loads(data): |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
497 |
del oldmark['id'] # dropped for now |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
498 |
del oldmark['reason'] # unused until then |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
499 |
oldobject = str(oldmark.pop('object')) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
500 |
oldsubjects = [str(s) for s in oldmark.pop('subjects', [])] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
501 |
LOOKUP_ERRORS = (error.RepoLookupError, error.LookupError) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
502 |
if len(oldobject) != 40: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
503 |
try: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
504 |
oldobject = repo[oldobject].node() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
505 |
except LOOKUP_ERRORS: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
506 |
pass |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
507 |
if any(len(s) != 40 for s in oldsubjects): |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
508 |
try: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
509 |
oldsubjects = [repo[s].node() for s in oldsubjects] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
510 |
except LOOKUP_ERRORS: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
511 |
pass |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
512 |
|
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
513 |
oldmark['date'] = '%i %i' % tuple(oldmark['date']) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
514 |
meta = dict((k.encode('utf-8'), v.encode('utf-8')) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
515 |
for k, v in oldmark.iteritems()) |
341
7653f80fd7a4
obsolete: harden convertion from first format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
340
diff
changeset
|
516 |
try: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
517 |
succs = [bin(n) for n in oldsubjects] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
518 |
succs = [n for n in succs if n != nullid] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
519 |
store.create(tr, bin(oldobject), succs, |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
520 |
0, meta) |
341
7653f80fd7a4
obsolete: harden convertion from first format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
340
diff
changeset
|
521 |
cnt += 1 |
7653f80fd7a4
obsolete: harden convertion from first format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
340
diff
changeset
|
522 |
except ValueError: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
523 |
repo.ui.write_err("invalid marker %s -> %s\n" |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
524 |
% (oldobject, oldsubjects)) |
341
7653f80fd7a4
obsolete: harden convertion from first format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
340
diff
changeset
|
525 |
err += 1 |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
526 |
unlink.append(repo.sjoin('obsoletemarkers')) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
527 |
tr.close() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
528 |
for path in unlink: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
529 |
util.unlink(path) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
530 |
finally: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
531 |
tr.release() |
224 | 532 |
finally: |
533 |
del repo._importoldobsolete |
|
534 |
l.release() |
|
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
535 |
if not some: |
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
536 |
ui.warn('nothing to do\n') |
224 | 537 |
ui.status('%i obsolete marker converted\n' % cnt) |
337
ebfd1b96a013
obsolete: convert try to guess what invalid node id are
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
336
diff
changeset
|
538 |
if err: |
ebfd1b96a013
obsolete: convert try to guess what invalid node id are
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
336
diff
changeset
|
539 |
ui.write_err('%i conversion failed. check you graph!\n' % err) |
224 | 540 |
|
276
f26e9bc5f7fc
obsolete: use new-style command registration
Patrick Mezard <patrick@mezard.eu>
parents:
275
diff
changeset
|
541 |
@command('debugsuccessors', [], '') |
273
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
542 |
def cmddebugsuccessors(ui, repo): |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
543 |
"""dump obsolete changesets and their successors |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
544 |
|
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
545 |
Each line matches an existing marker, the first identifier is the |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
546 |
obsolete changeset identifier, followed by it successors. |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
547 |
""" |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
548 |
lock = repo.lock() |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
549 |
try: |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
550 |
allsuccessors = repo.obsstore.precursors |
273
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
551 |
for old in sorted(allsuccessors): |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
552 |
successors = [sorted(m[1]) for m in allsuccessors[old]] |
273
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
553 |
for i, group in enumerate(sorted(successors)): |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
554 |
ui.write('%s' % short(old)) |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
555 |
for new in group: |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
556 |
ui.write(' %s' % short(new)) |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
557 |
ui.write('\n') |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
558 |
finally: |
87e4d1eec5e8
obsolete: add debugsuccessors command
Patrick Mezard <patrick@mezard.eu>
parents:
254
diff
changeset
|
559 |
lock.release() |
224 | 560 |
|
79
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
561 |
### Altering existing command |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
562 |
############################# |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
563 |
|
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
564 |
def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
565 |
res = origfn(ui, repo, *args, **opts) |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
566 |
if repo['.'].obsolete(): |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
567 |
ui.warn(_('Working directory parent is obsolete\n')) |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
568 |
return res |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
569 |
|
356
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
570 |
def warnobserrors(orig, ui, repo, *args, **kwargs): |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
571 |
"""display warning is the command resulted in more instable changeset""" |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
572 |
priorunstables = len(repo.revs('unstable()')) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
573 |
priorlatecomers = len(repo.revs('latecomer()')) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
574 |
priorconflictings = len(repo.revs('conflicting()')) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
575 |
#print orig, priorunstables |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
576 |
#print len(repo.revs('secret() - obsolete()')) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
577 |
try: |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
578 |
return orig(ui, repo, *args, **kwargs) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
579 |
finally: |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
580 |
newunstables = len(repo.revs('unstable()')) - priorunstables |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
581 |
newlatecomers = len(repo.revs('latecomer()')) - priorlatecomers |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
582 |
newconflictings = len(repo.revs('conflicting()')) - priorconflictings |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
583 |
#print orig, newunstables |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
584 |
#print len(repo.revs('secret() - obsolete()')) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
585 |
if newunstables > 0: |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
586 |
ui.warn(_('%i new unstables changesets\n') % newunstables) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
587 |
if newlatecomers > 0: |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
588 |
ui.warn(_('%i new latecomers changesets\n') % newlatecomers) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
589 |
if newconflictings > 0: |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
590 |
ui.warn(_('%i new conflictings changesets\n') % newconflictings) |
56d4c6207ef9
Move obserror warning into the obsolete extension.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
354
diff
changeset
|
591 |
|
320
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
592 |
def wrapcmdutilamend(orig, ui, repo, commitfunc, old, *args, **kwargs): |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
593 |
oldnode = old.node() |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
594 |
new = orig(ui, repo, commitfunc, old, *args, **kwargs) |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
595 |
if new != oldnode: |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
596 |
lock = repo.lock() |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
597 |
try: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
598 |
tr = repo.transaction('post-amend-obst') |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
599 |
try: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
600 |
meta = { |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
601 |
'date': '%i %i' % util.makedate(), |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
602 |
'user': ui.username(), |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
603 |
} |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
604 |
repo.obsstore.create(tr, oldnode, [new], 0, meta) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
605 |
tr.close() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
606 |
repo._clearobsoletecache() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
607 |
finally: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
608 |
tr.release() |
320
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
609 |
finally: |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
610 |
lock.release() |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
611 |
return new |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
612 |
|
79
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
613 |
def uisetup(ui): |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
614 |
extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc) |
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
615 |
extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc) |
320
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
616 |
if util.safehasattr(cmdutil, 'amend'): |
63f267bd2176
obsolete: basic commit --amend support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
311
diff
changeset
|
617 |
extensions.wrapfunction(cmdutil, 'amend', wrapcmdutilamend) |
217
786eb34d93ea
obsolete: refuse to push unstable changeset without -f
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
215
diff
changeset
|
618 |
extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads) |
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
619 |
extensions.wrapfunction(phases, 'advanceboundary', wrapclearcache) |
79
9906560f585e
[obsolete] issue a warning when parent of current directory is obsolete.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
75
diff
changeset
|
620 |
|
70
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
621 |
### serialisation |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
622 |
############################# |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
623 |
|
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
624 |
def _obsserialise(obssubrels, flike): |
74
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
625 |
"""serialise an obsolete relation mapping in a plain text one |
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
626 |
|
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
627 |
this is for subject -> [objects] mapping |
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
628 |
|
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
629 |
format is:: |
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
630 |
|
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
631 |
<subject-full-hex> <object-full-hex>\n""" |
70
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
632 |
for sub, objs in obssubrels.iteritems(): |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
633 |
for obj in objs: |
80
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
634 |
if sub is None: |
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
635 |
sub = nullid |
70
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
636 |
flike.write('%s %s\n' % (hex(sub), hex(obj))) |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
637 |
|
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
638 |
def _obsdeserialise(flike): |
74
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
639 |
"""read a file like object serialised with _obsserialise |
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
640 |
|
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
641 |
this desierialize into a {subject -> objects} mapping""" |
70
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
642 |
rels = {} |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
643 |
for line in flike: |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
644 |
subhex, objhex = line.split() |
80
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
645 |
subnode = bin(subhex) |
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
646 |
if subnode == nullid: |
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
647 |
subnode = None |
5d029a358252
[obsolete] add kill support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
79
diff
changeset
|
648 |
rels.setdefault( subnode, set()).add(bin(objhex)) |
70
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
649 |
return rels |
af4f7ef0a3c1
[obsolete] extract serialization logic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
69
diff
changeset
|
650 |
|
87
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
651 |
### diagnostique tools |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
652 |
############################# |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
653 |
|
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
654 |
def unstables(repo): |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
655 |
"""Return all unstable changeset""" |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
656 |
return scmutil.revrange(repo, ['obsolete():: and (not obsolete())']) |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
657 |
|
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
658 |
def newerversion(repo, obs): |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
659 |
"""Return the newer version of an obsolete changeset""" |
224 | 660 |
toproceed = set([(obs,)]) |
661 |
# XXX known optimization available |
|
87
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
662 |
newer = set() |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
663 |
objectrels = repo.obsstore.precursors |
87
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
664 |
while toproceed: |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
665 |
current = toproceed.pop() |
224 | 666 |
assert len(current) <= 1, 'splitting not handled yet. %r' % current |
351
4ecbaec1d664
Ignore buggy marker in newerversion
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
350
diff
changeset
|
667 |
current = [n for n in current if n != nullid] |
224 | 668 |
if current: |
669 |
n, = current |
|
670 |
if n in objectrels: |
|
671 |
markers = objectrels[n] |
|
672 |
for mark in markers: |
|
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
673 |
toproceed.add(tuple(mark[1])) |
224 | 674 |
else: |
675 |
newer.add(tuple(current)) |
|
132
64d16f07d67f
obsolete: alter newerversion return
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
131
diff
changeset
|
676 |
else: |
64d16f07d67f
obsolete: alter newerversion return
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
131
diff
changeset
|
677 |
newer.add(()) |
87
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
678 |
return sorted(newer) |
246b8fefd0a5
[evolution/obsolete] very experimental and crude evolve support.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
86
diff
changeset
|
679 |
|
86
7f763bada042
[obsolete] code section comment for repo subclassing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
85
diff
changeset
|
680 |
### repo subclassing |
7f763bada042
[obsolete] code section comment for repo subclassing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
85
diff
changeset
|
681 |
############################# |
7f763bada042
[obsolete] code section comment for repo subclassing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
85
diff
changeset
|
682 |
|
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
683 |
def reposetup(ui, repo): |
47
b73b3e3c9560
Don't overwrite non local repo.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
46
diff
changeset
|
684 |
if not repo.local(): |
b73b3e3c9560
Don't overwrite non local repo.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
46
diff
changeset
|
685 |
return |
b73b3e3c9560
Don't overwrite non local repo.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
46
diff
changeset
|
686 |
|
338
b922d144f93d
obsolete: we are not compatible with 2.1 any more
David Douard <david.douard@logilab.fr>
parents:
337
diff
changeset
|
687 |
if not util.safehasattr(repo.opener, 'tryread'): |
b922d144f93d
obsolete: we are not compatible with 2.1 any more
David Douard <david.douard@logilab.fr>
parents:
337
diff
changeset
|
688 |
raise util.Abort('Obsolete extension require Mercurial 2.2 (or later)') |
44
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
689 |
opush = repo.push |
210
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
690 |
o_updatebranchcache = repo.updatebranchcache |
44
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
691 |
|
203
9799d0aa53c8
[obsolete] add supprt for futur Hg 2.2
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
202
diff
changeset
|
692 |
# /!\ api change in Hg 2.2 (97efd26eb9576f39590812ea9) /!\ |
9799d0aa53c8
[obsolete] add supprt for futur Hg 2.2
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
202
diff
changeset
|
693 |
if util.safehasattr(repo, '_journalfiles'): # Hg 2.2 |
9799d0aa53c8
[obsolete] add supprt for futur Hg 2.2
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
202
diff
changeset
|
694 |
o_journalfiles = repo._journalfiles |
205
7ba30bd95a88
obsolete: fix rollback wrapper for 2.2-rc
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
204
diff
changeset
|
695 |
o_writejournal = repo._writejournal |
408
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
696 |
o_hook = repo.hook |
203
9799d0aa53c8
[obsolete] add supprt for futur Hg 2.2
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
202
diff
changeset
|
697 |
|
9799d0aa53c8
[obsolete] add supprt for futur Hg 2.2
Alain Leufroy <alain.leufroy@logilab.fr>
parents:
202
diff
changeset
|
698 |
|
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
699 |
class obsoletingrepo(repo.__class__): |
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
700 |
|
408
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
701 |
# workaround |
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
702 |
def hook(self, name, throw=False, **args): |
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
703 |
if 'pushkey' in name: |
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
704 |
args.pop('new') |
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
705 |
args.pop('old') |
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
706 |
return o_hook(name, throw=False, **args) |
6b2f50c81967
hook: work around insanely huge value in obsolete pushkey call
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
404
diff
changeset
|
707 |
|
53
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
708 |
### Public method |
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
709 |
def obsoletedby(self, node): |
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
710 |
"""return the set of node that make <node> obsolete (obj)""" |
224 | 711 |
others = set() |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
712 |
for marker in self.obsstore.precursors.get(node, []): |
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
713 |
others.update(marker[1]) |
224 | 714 |
return others |
53
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
715 |
|
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
716 |
def obsolete(self, node): |
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
717 |
"""return the set of node that <node> make obsolete (sub)""" |
334
fb83210bce32
obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
332
diff
changeset
|
718 |
return set(marker[0] for marker in self.obsstore.successors.get(node, [])) |
224 | 719 |
|
109
a2e8057117d3
obsolete: smarter initialisation of obsolete stuff from disk.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
95
diff
changeset
|
720 |
@util.propertycache |
a2e8057117d3
obsolete: smarter initialisation of obsolete stuff from disk.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
95
diff
changeset
|
721 |
def _obsoleteset(self): |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
722 |
"""the set of obsolete revision""" |
109
a2e8057117d3
obsolete: smarter initialisation of obsolete stuff from disk.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
95
diff
changeset
|
723 |
obs = set() |
126
c083fb43daee
obsolete: stop using rev as it rebuild the cache every time there is a fault
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
125
diff
changeset
|
724 |
nm = self.changelog.nodemap |
343 | 725 |
for prec in self.obsstore.precursors: |
726 |
rev = nm.get(prec) |
|
126
c083fb43daee
obsolete: stop using rev as it rebuild the cache every time there is a fault
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
125
diff
changeset
|
727 |
if rev is not None: |
c083fb43daee
obsolete: stop using rev as it rebuild the cache every time there is a fault
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
125
diff
changeset
|
728 |
obs.add(rev) |
109
a2e8057117d3
obsolete: smarter initialisation of obsolete stuff from disk.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
95
diff
changeset
|
729 |
return obs |
a2e8057117d3
obsolete: smarter initialisation of obsolete stuff from disk.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
95
diff
changeset
|
730 |
|
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
731 |
@util.propertycache |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
732 |
def _unstableset(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
733 |
"""the set of non obsolete revision with obsolete parent""" |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
734 |
return set(self.revs('(obsolete()::) - obsolete()')) |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
735 |
|
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
736 |
@util.propertycache |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
737 |
def _suspendedset(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
738 |
"""the set of obsolete parent with non obsolete descendant""" |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
739 |
return set(self.revs('obsolete() and obsolete()::unstable()')) |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
740 |
|
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
741 |
@util.propertycache |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
742 |
def _extinctset(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
743 |
"""the set of obsolete parent without non obsolete descendant""" |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
744 |
return set(self.revs('obsolete() - obsolete()::unstable()')) |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
745 |
|
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
746 |
@util.propertycache |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
747 |
def _latecomerset(self): |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
748 |
"""the set of rev trying to obsolete public revision""" |
332
36e2016d6563
obsolete: public changeset are no longer latecomer.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
321
diff
changeset
|
749 |
query = 'allsuccessors(public()) - obsolete() - public()' |
36e2016d6563
obsolete: public changeset are no longer latecomer.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
321
diff
changeset
|
750 |
return set(self.revs(query)) |
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
751 |
|
354
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
752 |
@util.propertycache |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
753 |
def _conflictingset(self): |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
754 |
"""the set of rev trying to obsolete public revision""" |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
755 |
conflicting = set() |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
756 |
obsstore = self.obsstore |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
757 |
newermap = {} |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
758 |
for ctx in self.set('(not public()) - obsolete()'): |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
759 |
prec = obsstore.successors.get(ctx.node(), ()) |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
760 |
toprocess = set(prec) |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
761 |
while toprocess: |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
762 |
prec = toprocess.pop()[0] |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
763 |
if prec not in newermap: |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
764 |
newermap[prec] = newerversion(self, prec) |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
765 |
newer = [n for n in newermap[prec] if n] # filter kill |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
766 |
if len(newer) > 1: |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
767 |
conflicting.add(ctx.rev()) |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
768 |
break |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
769 |
toprocess.update(obsstore.successors.get(prec, ())) |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
770 |
return conflicting |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
771 |
|
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
772 |
def _clearobsoletecache(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
773 |
if '_obsoleteset' in vars(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
774 |
del self._obsoleteset |
210
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
775 |
self._clearunstablecache() |
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
776 |
|
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
777 |
def updatebranchcache(self): |
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
778 |
o_updatebranchcache() |
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
779 |
self._clearunstablecache() |
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
780 |
|
168ea7d200a0
obsolete: blindly obsolete unstability cache when changeset are added
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
205
diff
changeset
|
781 |
def _clearunstablecache(self): |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
782 |
if '_unstableset' in vars(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
783 |
del self._unstableset |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
784 |
if '_suspendedset' in vars(self): |
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
785 |
del self._suspendedset |
254
3ff969da57ef
obsolete: fix error in cache invalidation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
253
diff
changeset
|
786 |
if '_extinctset' in vars(self): |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
787 |
del self._extinctset |
307
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
788 |
if '_latecomerset' in vars(self): |
9ac56d36d6ff
obsolete: add latecomer computation and display
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
306
diff
changeset
|
789 |
del self._latecomerset |
354
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
790 |
if '_conflictingset' in vars(self): |
bd26eb9714fb
obsolete: Detect conflicting changeset!
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
351
diff
changeset
|
791 |
del self._conflictingset |
135
1a08daef8a53
obsolete: add revset for various error case
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
132
diff
changeset
|
792 |
|
53
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
793 |
def addobsolete(self, sub, obj): |
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
794 |
"""Add a relation marking that node <sub> is a new version of <obj>""" |
224 | 795 |
assert sub != obj |
796 |
if not repo[obj].phase(): |
|
797 |
if sub is None: |
|
798 |
self.ui.warn( |
|
799 |
_("trying to kill immutable changeset %(obj)s\n") |
|
800 |
% {'obj': short(obj)}) |
|
801 |
if sub is not None: |
|
802 |
self.ui.warn( |
|
803 |
_("%(sub)s try to obsolete immutable changeset %(obj)s\n") |
|
804 |
% {'sub': short(sub), 'obj': short(obj)}) |
|
805 |
lock = self.lock() |
|
53
0bcbf690dfca
reorganise code
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
52
diff
changeset
|
806 |
try: |
361
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
807 |
tr = self.transaction('add-obsolete') |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
808 |
try: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
809 |
meta = { |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
810 |
'date': '%i %i' % util.makedate(), |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
811 |
'user': ui.username(), |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
812 |
} |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
813 |
subs = (sub == nullid) and [] or [sub] |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
814 |
mid = self.obsstore.create(tr, obj, subs, 0, meta) |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
815 |
tr.close() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
816 |
self._clearobsoletecache() |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
817 |
return mid |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
818 |
finally: |
ac7969043677
obsolete: adapt to core: marker are written in transaction now
Pierre-Yves.David@ens-lyon.org
parents:
360
diff
changeset
|
819 |
tr.release() |
224 | 820 |
finally: |
821 |
lock.release() |
|
822 |
||
298
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
823 |
def addcollapsedobsolete(self, oldnodes, newnode): |
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
824 |
"""Mark oldnodes as collapsed into newnode.""" |
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
825 |
# Assume oldnodes are all descendants of a single rev |
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
826 |
rootrevs = self.revs('roots(%ln)', oldnodes) |
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
827 |
assert len(rootrevs) == 1, rootrevs |
343 | 828 |
#rootnode = self[rootrevs[0]].node() |
298
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
829 |
for n in oldnodes: |
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
830 |
self.addobsolete(newnode, n) |
f597421662f7
obsolete: unify collapsed revisions markers handling
Patrick Mezard <patrick@mezard.eu>
parents:
297
diff
changeset
|
831 |
|
44
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
832 |
### pull // push support |
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
833 |
|
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
834 |
def push(self, remote, *args, **opts): |
74
c7dd26dec7fc
[obsolete] update docstring
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
73
diff
changeset
|
835 |
"""wrapper around pull that pull obsolete relation""" |
376
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
836 |
try: |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
837 |
result = opush(remote, *args, **opts) |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
838 |
except util.Abort, ex: |
390
54582eebeb08
obsolete: fix typos, improve messages
Patrick Mezard <patrick@mezard.eu>
parents:
388
diff
changeset
|
839 |
hint = _("use 'hg stabilize' to get a stable history " |
54582eebeb08
obsolete: fix typos, improve messages
Patrick Mezard <patrick@mezard.eu>
parents:
388
diff
changeset
|
840 |
"or --force to ignore warnings") |
376
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
841 |
if (len(ex.args) >= 1 |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
842 |
and ex.args[0].startswith('push includes ') |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
843 |
and ex.hint is None): |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
844 |
ex.hint = hint |
188afb394e10
obsolete: move hint punching to push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
375
diff
changeset
|
845 |
raise |
44
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
846 |
return result |
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
847 |
|
b243c10a5fbe
Add pushkey support for pull and push
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
43
diff
changeset
|
848 |
|
32
c27491be4431
obsolet: basic support (hide changeset)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
849 |
repo.__class__ = obsoletingrepo |
379
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
850 |
for arg in sys.argv: |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
851 |
if 'debugc' in arg: |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
852 |
break |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
853 |
else: |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
854 |
data = repo.opener.tryread('obsolete-relations') |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
855 |
if not data: |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
856 |
data = repo.sopener.tryread('obsoletemarkers') |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
857 |
if data: |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
858 |
raise util.Abort('old format of obsolete marker detected!\n' |
881c3eca314a
Wider triggering of the debug marker abort
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
378
diff
changeset
|
859 |
'run `hg debugconvertobsolete` once.') |