author | Anton Shestakov <av6@dwimlabs.net> |
Wed, 06 Mar 2019 16:56:25 +0800 | |
changeset 4429 | e10ebc58926e |
parent 4388 | 20d1ceef2df2 |
child 4439 | 2eafdca7ba4b |
permissions | -rw-r--r-- |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
1 |
# Copyright 2017 Octobus <contact@octobus.net> |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
2 |
# |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
3 |
# This software may be used and distributed according to the terms of the |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
4 |
# GNU General Public License version 2 or any later version. |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
5 |
""" |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
6 |
Compatibility module |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
7 |
""" |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
8 |
|
3499
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
9 |
import inspect |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
10 |
|
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
11 |
from mercurial import ( |
2834
38db1466c6fb
log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents:
2794
diff
changeset
|
12 |
context, |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
13 |
copies, |
3932
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
14 |
encoding, |
3499
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
15 |
mdiff, |
2751
4f560f117fff
compat: use 'safehasattr' over 'hasattr'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2693
diff
changeset
|
16 |
obsolete, |
3693
105d2d2c6a2e
compat: drop obsutile layer
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3692
diff
changeset
|
17 |
obsutil, |
3767
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
18 |
repair, |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
19 |
scmutil, |
2751
4f560f117fff
compat: use 'safehasattr' over 'hasattr'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
2693
diff
changeset
|
20 |
util, |
4341
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
21 |
ui as uimod, |
3692
f9988919d69e
compat: drop vfsmod compat layer
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3680
diff
changeset
|
22 |
vfs as vfsmod, |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
23 |
) |
3524
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
24 |
from mercurial.hgweb import hgweb_mod |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
25 |
|
3483
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
26 |
# hg < 4.6 compat (c8e2d6ed1f9e) |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
27 |
try: |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
28 |
from mercurial import logcmdutil |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
29 |
changesetdisplayer = logcmdutil.changesetdisplayer |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
30 |
changesetprinter = logcmdutil.changesetprinter |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
31 |
displaygraph = logcmdutil.displaygraph |
3921
28824ad64a12
compat: restore compatibility with Mercurial <= 4.5
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3908
diff
changeset
|
32 |
changesetdiffer = logcmdutil.changesetdiffer |
3483
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
33 |
except (AttributeError, ImportError): |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
34 |
from mercurial import cmdutil |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
35 |
changesetdisplayer = cmdutil.show_changeset |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
36 |
changesetprinter = cmdutil.changeset_printer |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
37 |
displaygraph = cmdutil.displaygraph |
3921
28824ad64a12
compat: restore compatibility with Mercurial <= 4.5
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3908
diff
changeset
|
38 |
changesetdiffer = None |
3483
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
39 |
|
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
40 |
from . import ( |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
41 |
exthelper, |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
42 |
) |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
43 |
|
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 |
eh = exthelper.exthelper() |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
45 |
|
3283
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
46 |
def isobsnotesupported(): |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
47 |
# hack to know obsnote is supported. The patches for obsnote support was |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
48 |
# pushed before the obsfateprinter patches, so this will serve as a good |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
49 |
# check |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
50 |
if not obsutil: |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
51 |
return False |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
52 |
return util.safehasattr(obsutil, 'obsfateprinter') |
039c4b8dc3ed
obsnote: warn if user try to store a note in obsmarker on an older hg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3074
diff
changeset
|
53 |
|
2834
38db1466c6fb
log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents:
2794
diff
changeset
|
54 |
# Evolution renaming compat |
38db1466c6fb
log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents:
2794
diff
changeset
|
55 |
|
4429
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
56 |
TROUBLES = { |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
57 |
'ORPHAN': 'orphan', |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
58 |
'CONTENTDIVERGENT': 'content-divergent', |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
59 |
'PHASEDIVERGENT': 'phase-divergent', |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
60 |
} |
2836
feaa52680682
log: bumped was renamed into phasedivergent
Boris Feld <boris.feld@octobus.net>
parents:
2835
diff
changeset
|
61 |
|
4341
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
62 |
if util.safehasattr(uimod.ui, 'makeprogress'): |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
63 |
def progress(ui, topic, pos, item="", unit="", total=None): |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
64 |
progress = ui.makeprogress(topic, unit, total) |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
65 |
if pos is not None: |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
66 |
progress.update(pos, item=item) |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
67 |
else: |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
68 |
progress.complete() |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
69 |
else: |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
70 |
def progress(ui, topic, pos, item="", unit="", total=None): |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
71 |
ui.progress(topic, pos, item="", unit="", total=None) |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
72 |
|
2840
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
73 |
# XXX: Better detection of property cache |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
74 |
if 'predecessors' not in dir(obsolete.obsstore): |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
75 |
@property |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
76 |
def predecessors(self): |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
77 |
return self.precursors |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
78 |
|
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
79 |
obsolete.obsstore.predecessors = predecessors |
2845
9fc6a4615ae5
revset: unstable volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2841
diff
changeset
|
80 |
|
3298
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
81 |
def memfilectx(repo, ctx, fctx, flags, copied, path): |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
82 |
# XXX Would it be better at the module level? |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
83 |
varnames = context.memfilectx.__init__.__code__.co_varnames |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
84 |
ctxmandatory = varnames[2] == "changectx" |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
85 |
|
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
86 |
if ctxmandatory: |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
87 |
mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(), |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
88 |
islink='l' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
89 |
isexec='x' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
90 |
copied=copied.get(path)) |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
91 |
else: |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
92 |
mctx = context.memfilectx(repo, fctx.path(), fctx.data(), |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
93 |
islink='l' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
94 |
isexec='x' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
95 |
copied=copied.get(path)) |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
96 |
return mctx |
3408
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
97 |
|
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
98 |
def getcachevfs(repo): |
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
99 |
cachevfs = getattr(repo, 'cachevfs', None) |
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
100 |
if cachevfs is None: |
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
101 |
cachevfs = vfsmod.vfs(repo.vfs.join('cache')) |
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
102 |
cachevfs.createmode = repo.store.createmode |
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
103 |
return cachevfs |
3499
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
104 |
|
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
105 |
def strdiff(a, b, fn1, fn2): |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
106 |
""" A version of mdiff.unidiff for comparing two strings |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
107 |
""" |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
108 |
args = [a, '', b, '', fn1, fn2] |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
109 |
|
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
110 |
# hg < 4.6 compat 8b6dd3922f70 |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
111 |
argspec = inspect.getargspec(mdiff.unidiff) |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
112 |
|
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
113 |
if 'binary' in argspec.args: |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
114 |
args.append(False) |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
115 |
|
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
116 |
return mdiff.unidiff(*args) |
3514
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
117 |
|
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
118 |
# date related |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
119 |
|
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
120 |
try: |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
121 |
import mercurial.utils.dateutil |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
122 |
makedate = mercurial.utils.dateutil.makedate |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
123 |
parsedate = mercurial.utils.dateutil.parsedate |
4304
604732387e33
linter: silence rightful complains about unused variable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4223
diff
changeset
|
124 |
except ImportError: |
3514
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
125 |
import mercurial.util |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
126 |
makedate = mercurial.util.makedate |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
127 |
parsedate = mercurial.util.parsedate |
3524
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
128 |
|
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
129 |
def wireprotocommand(exthelper, name, args='', permission='pull'): |
3680
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
130 |
try: |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
131 |
# Since b4d85bc1 |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
132 |
from mercurial.wireprotov1server import wireprotocommand |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
133 |
return wireprotocommand(name, args, permission=permission) |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
134 |
except (ImportError, AttributeError): |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
135 |
from mercurial import wireproto |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
136 |
|
3524
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
137 |
if 3 <= len(wireproto.wireprotocommand.func_defaults): |
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
138 |
return wireproto.wireprotocommand(name, args, permission=permission) |
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
139 |
|
3680
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
140 |
# <= hg-4.5 permission must be registered in dictionnary |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
141 |
def decorator(func): |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
142 |
@eh.extsetup |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
143 |
def install(ui): |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
144 |
hgweb_mod.perms[name] = permission |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
145 |
wireproto.commands[name] = (func, args) |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
146 |
return decorator |
3616
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
147 |
|
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
148 |
# mercurial <= 4.5 do not have the updateresult object |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
149 |
try: |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
150 |
from mercurial.merge import updateresult |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
151 |
except (ImportError, AttributeError): |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
152 |
updateresult = None |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
153 |
|
3767
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
154 |
# 46c2b19a1263f18a5829a21b7a5053019b0c5a31 in hg moved repair.stripbmrevset to |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
155 |
# scmutil.bookmarkrevs |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
156 |
# This change is a part of 4.7 cycle, so drop this when we drop support for 4.6 |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
157 |
try: |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
158 |
bmrevset = repair.stripbmrevset |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
159 |
except AttributeError: |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
160 |
bmrevset = scmutil.bookmarkrevs |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
161 |
|
3616
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
162 |
def hasconflict(upres): |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
163 |
if updateresult is None: |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
164 |
return bool(upres[-1]) |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
165 |
return bool(upres.unresolvedcount) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
166 |
|
4223
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
167 |
hg48 = util.safehasattr(copies, 'stringutil') |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
168 |
# code imported from Mercurial core at ae17555ef93f + patch |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
169 |
def fixedcopytracing(repo, c1, c2, base): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
170 |
"""A complete copy-patse of copies._fullcopytrace with a one line fix to |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
171 |
handle when the base is not parent of both c1 and c2. This should be |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
172 |
converted in a compat function once https://phab.mercurial-scm.org/D3896 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
173 |
gets in and once we drop support for 4.7, this should be removed.""" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
174 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
175 |
from mercurial import pathutil |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
176 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
177 |
# In certain scenarios (e.g. graft, update or rebase), base can be |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
178 |
# overridden We still need to know a real common ancestor in this case We |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
179 |
# can't just compute _c1.ancestor(_c2) and compare it to ca, because there |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
180 |
# can be multiple common ancestors, e.g. in case of bidmerge. Because our |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
181 |
# caller may not know if the revision passed in lieu of the CA is a genuine |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
182 |
# common ancestor or not without explicitly checking it, it's better to |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
183 |
# determine that here. |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
184 |
# |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
185 |
# base.isancestorof(wc) is False, work around that |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
186 |
_c1 = c1.p1() if c1.rev() is None else c1 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
187 |
_c2 = c2.p1() if c2.rev() is None else c2 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
188 |
# an endpoint is "dirty" if it isn't a descendant of the merge base |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
189 |
# if we have a dirty endpoint, we need to trigger graft logic, and also |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
190 |
# keep track of which endpoint is dirty |
3908
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
191 |
if util.safehasattr(base, 'isancestorof'): |
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
192 |
dirtyc1 = not base.isancestorof(_c1) |
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
193 |
dirtyc2 = not base.isancestorof(_c2) |
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
194 |
else: # hg <= 4.6 |
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
195 |
dirtyc1 = not base.descendant(_c1) |
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
196 |
dirtyc2 = not base.descendant(_c2) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
197 |
graft = dirtyc1 or dirtyc2 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
198 |
tca = base |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
199 |
if graft: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
200 |
tca = _c1.ancestor(_c2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
201 |
|
4388
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
202 |
# hg < 4.8 compat (dc50121126ae) |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
203 |
try: |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
204 |
limit = copies._findlimit(repo, c1, c2) |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
205 |
except (AttributeError, TypeError): |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
206 |
limit = copies._findlimit(repo, c1.rev(), c2.rev()) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
207 |
if limit is None: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
208 |
# no common ancestor, no copies |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
209 |
return {}, {}, {}, {}, {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
210 |
repo.ui.debug(" searching for copies back to rev %d\n" % limit) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
211 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
212 |
m1 = c1.manifest() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
213 |
m2 = c2.manifest() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
214 |
mb = base.manifest() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
215 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
216 |
# gather data from _checkcopies: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
217 |
# - diverge = record all diverges in this dict |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
218 |
# - copy = record all non-divergent copies in this dict |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
219 |
# - fullcopy = record all copies in this dict |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
220 |
# - incomplete = record non-divergent partial copies here |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
221 |
# - incompletediverge = record divergent partial copies here |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
222 |
diverge = {} # divergence data is shared |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
223 |
incompletediverge = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
224 |
data1 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
225 |
'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
226 |
'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
227 |
'diverge': diverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
228 |
'incompletediverge': incompletediverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
229 |
} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
230 |
data2 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
231 |
'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
232 |
'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
233 |
'diverge': diverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
234 |
'incompletediverge': incompletediverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
235 |
} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
236 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
237 |
# find interesting file sets from manifests |
4223
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
238 |
if hg48: |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
239 |
addedinm1 = m1.filesnotin(mb, repo.narrowmatch()) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
240 |
addedinm2 = m2.filesnotin(mb, repo.narrowmatch()) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
241 |
else: |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
242 |
addedinm1 = m1.filesnotin(mb) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
243 |
addedinm2 = m2.filesnotin(mb) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
244 |
bothnew = sorted(addedinm1 & addedinm2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
245 |
if tca == base: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
246 |
# unmatched file from base |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
247 |
u1r, u2r = copies._computenonoverlap(repo, c1, c2, addedinm1, addedinm2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
248 |
u1u, u2u = u1r, u2r |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
249 |
else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
250 |
# unmatched file from base (DAG rotation in the graft case) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
251 |
u1r, u2r = copies._computenonoverlap(repo, c1, c2, addedinm1, addedinm2, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
252 |
baselabel='base') |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
253 |
# unmatched file from topological common ancestors (no DAG rotation) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
254 |
# need to recompute this for directory move handling when grafting |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
255 |
mta = tca.manifest() |
4223
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
256 |
if hg48: |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
257 |
m1f = m1.filesnotin(mta, repo.narrowmatch()) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
258 |
m2f = m2.filesnotin(mta, repo.narrowmatch()) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
259 |
baselabel = 'topological common ancestor' |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
260 |
u1u, u2u = copies._computenonoverlap(repo, c1, c2, m1f, m2f, |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
261 |
baselabel=baselabel) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
262 |
else: |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
263 |
u1u, u2u = copies._computenonoverlap(repo, c1, c2, m1.filesnotin(mta), |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
264 |
m2.filesnotin(mta), |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
265 |
baselabel='topological common ancestor') |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
266 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
267 |
for f in u1u: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
268 |
copies._checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
269 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
270 |
for f in u2u: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
271 |
copies._checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
272 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
273 |
copy = dict(data1['copy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
274 |
copy.update(data2['copy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
275 |
fullcopy = dict(data1['fullcopy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
276 |
fullcopy.update(data2['fullcopy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
277 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
278 |
if dirtyc1: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
279 |
copies._combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
280 |
incompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
281 |
else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
282 |
copies._combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
283 |
incompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
284 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
285 |
renamedelete = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
286 |
renamedeleteset = set() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
287 |
divergeset = set() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
288 |
for of, fl in list(diverge.items()): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
289 |
if len(fl) == 1 or of in c1 or of in c2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
290 |
del diverge[of] # not actually divergent, or not a rename |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
291 |
if of not in c1 and of not in c2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
292 |
# renamed on one side, deleted on the other side, but filter |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
293 |
# out files that have been renamed and then deleted |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
294 |
renamedelete[of] = [f for f in fl if f in c1 or f in c2] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
295 |
renamedeleteset.update(fl) # reverse map for below |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
296 |
else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
297 |
divergeset.update(fl) # reverse map for below |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
298 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
299 |
if bothnew: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
300 |
repo.ui.debug(" unmatched files new in both:\n %s\n" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
301 |
% "\n ".join(bothnew)) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
302 |
bothdiverge = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
303 |
bothincompletediverge = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
304 |
remainder = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
305 |
both1 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
306 |
'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
307 |
'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
308 |
'diverge': bothdiverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
309 |
'incompletediverge': bothincompletediverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
310 |
} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
311 |
both2 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
312 |
'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
313 |
'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
314 |
'diverge': bothdiverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
315 |
'incompletediverge': bothincompletediverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
316 |
} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
317 |
for f in bothnew: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
318 |
copies._checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
319 |
copies._checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
320 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
321 |
if dirtyc1 and dirtyc2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
322 |
pass |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
323 |
elif dirtyc1: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
324 |
# incomplete copies may only be found on the "dirty" side for bothnew |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
325 |
assert not both2['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
326 |
remainder = copies._combinecopies({}, both1['incomplete'], copy, bothdiverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
327 |
bothincompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
328 |
elif dirtyc2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
329 |
assert not both1['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
330 |
remainder = copies._combinecopies({}, both2['incomplete'], copy, bothdiverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
331 |
bothincompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
332 |
else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
333 |
# incomplete copies and divergences can't happen outside grafts |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
334 |
assert not both1['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
335 |
assert not both2['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
336 |
assert not bothincompletediverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
337 |
for f in remainder: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
338 |
assert f not in bothdiverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
339 |
ic = remainder[f] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
340 |
if ic[0] in (m1 if dirtyc1 else m2): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
341 |
# backed-out rename on one side, but watch out for deleted files |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
342 |
bothdiverge[f] = ic |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
343 |
for of, fl in bothdiverge.items(): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
344 |
if len(fl) == 2 and fl[0] == fl[1]: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
345 |
copy[fl[0]] = of # not actually divergent, just matching renames |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
346 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
347 |
if fullcopy and repo.ui.debugflag: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
348 |
repo.ui.debug(" all copies found (* = to merge, ! = divergent, " |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
349 |
"% = renamed and deleted):\n") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
350 |
for f in sorted(fullcopy): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
351 |
note = "" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
352 |
if f in copy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
353 |
note += "*" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
354 |
if f in divergeset: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
355 |
note += "!" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
356 |
if f in renamedeleteset: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
357 |
note += "%" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
358 |
repo.ui.debug(" src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
359 |
note)) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
360 |
del divergeset |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
361 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
362 |
if not fullcopy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
363 |
return copy, {}, diverge, renamedelete, {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
364 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
365 |
repo.ui.debug(" checking for directory renames\n") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
366 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
367 |
# generate a directory move map |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
368 |
d1, d2 = c1.dirs(), c2.dirs() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
369 |
# Hack for adding '', which is not otherwise added, to d1 and d2 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
370 |
d1.addpath('/') |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
371 |
d2.addpath('/') |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
372 |
invalid = set() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
373 |
dirmove = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
374 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
375 |
# examine each file copy for a potential directory move, which is |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
376 |
# when all the files in a directory are moved to a new directory |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
377 |
for dst, src in fullcopy.iteritems(): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
378 |
dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
379 |
if dsrc in invalid: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
380 |
# already seen to be uninteresting |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
381 |
continue |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
382 |
elif dsrc in d1 and ddst in d1: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
383 |
# directory wasn't entirely moved locally |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
384 |
invalid.add(dsrc + "/") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
385 |
elif dsrc in d2 and ddst in d2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
386 |
# directory wasn't entirely moved remotely |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
387 |
invalid.add(dsrc + "/") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
388 |
elif dsrc + "/" in dirmove and dirmove[dsrc + "/"] != ddst + "/": |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
389 |
# files from the same directory moved to two different places |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
390 |
invalid.add(dsrc + "/") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
391 |
else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
392 |
# looks good so far |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
393 |
dirmove[dsrc + "/"] = ddst + "/" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
394 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
395 |
for i in invalid: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
396 |
if i in dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
397 |
del dirmove[i] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
398 |
del d1, d2, invalid |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
399 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
400 |
if not dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
401 |
return copy, {}, diverge, renamedelete, {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
402 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
403 |
for d in dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
404 |
repo.ui.debug(" discovered dir src: '%s' -> dst: '%s'\n" % |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
405 |
(d, dirmove[d])) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
406 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
407 |
movewithdir = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
408 |
# check unaccounted nonoverlapping files against directory moves |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
409 |
for f in u1r + u2r: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
410 |
if f not in fullcopy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
411 |
for d in dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
412 |
if f.startswith(d): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
413 |
# new file added in a directory that was moved, move it |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
414 |
df = dirmove[d] + f[len(d):] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
415 |
if df not in copy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
416 |
movewithdir[f] = df |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
417 |
repo.ui.debug((" pending file src: '%s' -> " |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
418 |
"dst: '%s'\n") % (f, df)) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
419 |
break |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
420 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
421 |
return copy, movewithdir, diverge, renamedelete, dirmove |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
422 |
|
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
423 |
if util.safehasattr(copies, '_fullcopytracing'): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
424 |
copies._fullcopytracing = fixedcopytracing |
3932
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
425 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
426 |
if not util.safehasattr(obsutil, "_succs"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
427 |
class _succs(list): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
428 |
"""small class to represent a successors with some metadata about it""" |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
429 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
430 |
def __init__(self, *args, **kwargs): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
431 |
super(_succs, self).__init__(*args, **kwargs) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
432 |
self.markers = set() |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
433 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
434 |
def copy(self): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
435 |
new = _succs(self) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
436 |
new.markers = self.markers.copy() |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
437 |
return new |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
438 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
439 |
@util.propertycache |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
440 |
def _set(self): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
441 |
# immutable |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
442 |
return set(self) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
443 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
444 |
def canmerge(self, other): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
445 |
return self._set.issubset(other._set) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
446 |
else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
447 |
from mercurial.obsutil import _succs |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
448 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
449 |
def wrap_succs(succs): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
450 |
""" Wrap old data format of successorsets (tuple) only if if's not yet a |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
451 |
_succs instance |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
452 |
""" |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
453 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
454 |
if not util.safehasattr(succs, "markers"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
455 |
return _succs(succs) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
456 |
else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
457 |
return succs |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
458 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
459 |
if not util.safehasattr(obsutil, "markersdates"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
460 |
MARKERS_DATE_COMPAT = True |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
461 |
else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
462 |
MARKERS_DATE_COMPAT = False |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
463 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
464 |
def markersdates(markers): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
465 |
"""returns the list of dates for a list of markers |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
466 |
""" |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
467 |
if MARKERS_DATE_COMPAT is False: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
468 |
return obsutil.markersdates(markers) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
469 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
470 |
return [m[4] for m in markers] |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
471 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
472 |
if not util.safehasattr(obsutil, "markersusers"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
473 |
MARKERS_USERS_COMPAT = True |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
474 |
else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
475 |
MARKERS_USERS_COMPAT = False |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
476 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
477 |
def markersusers(markers): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
478 |
""" Returns a sorted list of markers users without duplicates |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
479 |
""" |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
480 |
if MARKERS_USERS_COMPAT is False: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
481 |
return obsutil.markersusers(markers) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
482 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
483 |
markersmeta = [dict(m[3]) for m in markers] |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
484 |
users = set(encoding.tolocal(meta['user']) for meta in markersmeta |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
485 |
if meta.get('user')) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
486 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
487 |
return sorted(users) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
488 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
489 |
if not util.safehasattr(obsutil, "markersoperations"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
490 |
MARKERS_OPERATIONS_COMPAT = True |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
491 |
else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
492 |
MARKERS_OPERATIONS_COMPAT = False |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
493 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
494 |
def markersoperations(markers): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
495 |
""" Returns a sorted list of markers operations without duplicates |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
496 |
""" |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
497 |
if MARKERS_OPERATIONS_COMPAT is False: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
498 |
return obsutil.markersoperations(markers) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
499 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
500 |
markersmeta = [dict(m[3]) for m in markers] |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
501 |
operations = set(meta.get('operation') for meta in markersmeta |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
502 |
if meta.get('operation')) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
503 |
|
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
504 |
return sorted(operations) |