Mercurial > evolve
annotate hgext3rd/evolve/compat.py @ 4488:6c0992ce05f7
compat: drop getcachevfs, repo.cachevfs is supported in hg 4.4
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Sun, 07 Apr 2019 20:00:16 +0200 |
parents | 05f8908df4ce |
children | e7b44e9c38d2 |
rev | line source |
---|---|
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, |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
22 ) |
3524
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
23 from mercurial.hgweb import hgweb_mod |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
24 |
3483
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
25 # hg < 4.6 compat (c8e2d6ed1f9e) |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
26 try: |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
27 from mercurial import logcmdutil |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
28 changesetdisplayer = logcmdutil.changesetdisplayer |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
29 changesetprinter = logcmdutil.changesetprinter |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
30 displaygraph = logcmdutil.displaygraph |
3921
28824ad64a12
compat: restore compatibility with Mercurial <= 4.5
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3908
diff
changeset
|
31 changesetdiffer = logcmdutil.changesetdiffer |
3483
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
32 except (AttributeError, ImportError): |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
33 from mercurial import cmdutil |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
34 changesetdisplayer = cmdutil.show_changeset |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
35 changesetprinter = cmdutil.changeset_printer |
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
36 displaygraph = cmdutil.displaygraph |
3921
28824ad64a12
compat: restore compatibility with Mercurial <= 4.5
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3908
diff
changeset
|
37 changesetdiffer = None |
3483
f03845bfd015
compat: add wrapper for logcmdutil functions
Yuya Nishihara <yuya@tcha.org>
parents:
3408
diff
changeset
|
38 |
2525
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
39 from . import ( |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
40 exthelper, |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
41 ) |
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 eh = exthelper.exthelper() |
5adb8bdb935e
compatibility: backport mercurial 176d1a0ce385
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 |
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
|
45 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
|
46 # 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
|
47 # 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
|
48 # 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
|
49 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
|
50 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
|
51 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
|
52 |
2834
38db1466c6fb
log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents:
2794
diff
changeset
|
53 # Evolution renaming compat |
38db1466c6fb
log: unstable was renamed into orphan
Boris Feld <boris.feld@octobus.net>
parents:
2794
diff
changeset
|
54 |
4429
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
55 TROUBLES = { |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
56 'ORPHAN': 'orphan', |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
57 'CONTENTDIVERGENT': 'content-divergent', |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
58 'PHASEDIVERGENT': 'phase-divergent', |
e10ebc58926e
compat: remove old vocabulary change fallbacks
Anton Shestakov <av6@dwimlabs.net>
parents:
4388
diff
changeset
|
59 } |
2836
feaa52680682
log: bumped was renamed into phasedivergent
Boris Feld <boris.feld@octobus.net>
parents:
2835
diff
changeset
|
60 |
4341
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
61 if util.safehasattr(uimod.ui, 'makeprogress'): |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
62 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
|
63 progress = ui.makeprogress(topic, unit, total) |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
64 if pos is not None: |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
65 progress.update(pos, item=item) |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
66 else: |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
67 progress.complete() |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
68 else: |
d1aab9d82f5b
evolve: adapt for deprecated ui.progress()
Martin von Zweigbergk <martinvonz@google.com>
parents:
4328
diff
changeset
|
69 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
|
70 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
|
71 |
2840
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
72 # XXX: Better detection of property cache |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
73 if 'predecessors' not in dir(obsolete.obsstore): |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
74 @property |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
75 def predecessors(self): |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
76 return self.precursors |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
77 |
dfad30be866c
context: precursors was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2839
diff
changeset
|
78 obsolete.obsstore.predecessors = predecessors |
2845
9fc6a4615ae5
revset: unstable volatile set was deprecated
Boris Feld <boris.feld@octobus.net>
parents:
2841
diff
changeset
|
79 |
3298
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
80 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
|
81 # 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
|
82 varnames = context.memfilectx.__init__.__code__.co_varnames |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
83 |
4460
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
84 if "copysource" in varnames: |
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
85 mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(), |
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
86 islink='l' in flags, |
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
87 isexec='x' in flags, |
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
88 copysource=copied.get(path)) |
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
89 # compat with hg <- 4.9 |
dd679f5fc96f
compat: add support for new arg name in memfilectx.__init__
Martin von Zweigbergk <martinvonz@google.com>
parents:
4388
diff
changeset
|
90 elif varnames[2] == "changectx": |
3298
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
91 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
|
92 islink='l' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
93 isexec='x' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
94 copied=copied.get(path)) |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
95 else: |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
96 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
|
97 islink='l' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
98 isexec='x' in flags, |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
99 copied=copied.get(path)) |
f4b06f44d274
memfilectx: changectx argument is not mandatory
Boris Feld <boris.feld@octobus.net>
parents:
3283
diff
changeset
|
100 return mctx |
3408
f4ea9652661d
cachevfs: use a compatibility later for all access
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3298
diff
changeset
|
101 |
3499
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
102 def strdiff(a, b, fn1, fn2): |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
103 """ 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
|
104 """ |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
105 args = [a, '', b, '', fn1, fn2] |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
106 |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
107 # hg < 4.6 compat 8b6dd3922f70 |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
108 argspec = inspect.getargspec(mdiff.unidiff) |
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 if 'binary' in argspec.args: |
512706514555
obsfate: fix changeset description diff computing
Boris Feld <boris.feld@octobus.net>
parents:
3483
diff
changeset
|
111 args.append(False) |
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 return mdiff.unidiff(*args) |
3514
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
114 |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
115 # date related |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
116 |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
117 try: |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
118 import mercurial.utils.dateutil |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
119 makedate = mercurial.utils.dateutil.makedate |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
120 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
|
121 except ImportError: |
3514
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
122 import mercurial.util |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
123 makedate = mercurial.util.makedate |
498f782ccb4b
compat: add compat layer for date related functions
Boris Feld <boris.feld@octobus.net>
parents:
3499
diff
changeset
|
124 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
|
125 |
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
126 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
|
127 try: |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
128 # Since b4d85bc1 |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 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
|
133 |
3524
6d4095e6bdd3
obsdiscovery: add compatibility layer to register wireproto command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3514
diff
changeset
|
134 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
|
135 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
|
136 |
3680
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
137 # <= 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
|
138 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
|
139 @eh.extsetup |
e2a91d4d207d
evolve: handle wireproto module deletion for registering new commands
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3668
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 return decorator |
3616
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
144 |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
145 # 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
|
146 try: |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
147 from mercurial.merge import updateresult |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
148 except (ImportError, AttributeError): |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
149 updateresult = None |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
150 |
3767
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
151 # 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
|
152 # scmutil.bookmarkrevs |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
153 # 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
|
154 try: |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
155 bmrevset = repair.stripbmrevset |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
156 except AttributeError: |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
157 bmrevset = scmutil.bookmarkrevs |
115caa4e5278
evolve: add compat for repair.stripbmrevset which is moved to scmutil
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3701
diff
changeset
|
158 |
3616
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
159 def hasconflict(upres): |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
160 if updateresult is None: |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
161 return bool(upres[-1]) |
f6d629514607
compat: use updateresult API if available
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3575
diff
changeset
|
162 return bool(upres.unresolvedcount) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
163 |
4223
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
164 hg48 = util.safehasattr(copies, 'stringutil') |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
165 # 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
|
166 def fixedcopytracing(repo, c1, c2, base): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
167 """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
|
168 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
|
169 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
|
170 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
|
171 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
172 from mercurial import pathutil |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
173 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
174 # 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
|
175 # 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
|
176 # 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
|
177 # 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
|
178 # 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
|
179 # 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
|
180 # determine that here. |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
181 # |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
182 # 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
|
183 _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
|
184 _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
|
185 # 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
|
186 # 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
|
187 # 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
|
188 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
|
189 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
|
190 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
|
191 else: # hg <= 4.6 |
2af10d0a59e0
compat: use older API for older version
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3882
diff
changeset
|
192 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
|
193 dirtyc2 = not base.descendant(_c2) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
194 graft = dirtyc1 or dirtyc2 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
195 tca = base |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
196 if graft: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
197 tca = _c1.ancestor(_c2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
198 |
4388
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
199 # hg < 4.8 compat (dc50121126ae) |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
200 try: |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
201 limit = copies._findlimit(repo, c1, c2) |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
202 except (AttributeError, TypeError): |
20d1ceef2df2
compat: pass contexts to _findlimit() (issue6066)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4341
diff
changeset
|
203 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
|
204 if limit is None: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
205 # no common ancestor, no copies |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
206 return {}, {}, {}, {}, {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
207 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
|
208 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
209 m1 = c1.manifest() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
210 m2 = c2.manifest() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
211 mb = base.manifest() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
212 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
213 # gather data from _checkcopies: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
214 # - 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
|
215 # - 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
|
216 # - 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
|
217 # - 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
|
218 # - incompletediverge = record divergent partial copies here |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
219 diverge = {} # divergence data is shared |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
220 incompletediverge = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
221 data1 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
222 'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
223 'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
224 'diverge': diverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
225 'incompletediverge': incompletediverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
226 } |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
227 data2 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
228 'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
229 'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
230 'diverge': diverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
231 'incompletediverge': incompletediverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
232 } |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
233 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
234 # 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
|
235 if hg48: |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
236 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
|
237 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
|
238 else: |
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) |
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) |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
241 bothnew = sorted(addedinm1 & addedinm2) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
242 if tca == base: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
243 # unmatched file from base |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
244 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
|
245 u1u, u2u = u1r, u2r |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
246 else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
247 # 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
|
248 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
|
249 baselabel='base') |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
250 # 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
|
251 # 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
|
252 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
|
253 if hg48: |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 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
|
258 baselabel=baselabel) |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
259 else: |
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, m1.filesnotin(mta), |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
261 m2.filesnotin(mta), |
4a3d588e5311
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow
Boris Feld <boris.feld@octobus.net>
parents:
3932
diff
changeset
|
262 baselabel='topological common ancestor') |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
263 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
264 for f in u1u: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
265 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
|
266 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
267 for f in u2u: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
268 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
|
269 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
270 copy = dict(data1['copy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
271 copy.update(data2['copy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
272 fullcopy = dict(data1['fullcopy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
273 fullcopy.update(data2['fullcopy']) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
274 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
275 if dirtyc1: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
276 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
|
277 incompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
278 else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
279 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
|
280 incompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
281 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
282 renamedelete = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
283 renamedeleteset = set() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
284 divergeset = set() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
285 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
|
286 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
|
287 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
|
288 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
|
289 # 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
|
290 # 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
|
291 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
|
292 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
|
293 else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
294 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
|
295 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
296 if bothnew: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
297 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
|
298 % "\n ".join(bothnew)) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
299 bothdiverge = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
300 bothincompletediverge = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
301 remainder = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
302 both1 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
303 'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
304 'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
305 'diverge': bothdiverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
306 'incompletediverge': bothincompletediverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
307 } |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
308 both2 = {'copy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
309 'fullcopy': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
310 'incomplete': {}, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
311 'diverge': bothdiverge, |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
312 'incompletediverge': bothincompletediverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
313 } |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
314 for f in bothnew: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
315 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
|
316 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
|
317 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
318 if dirtyc1 and dirtyc2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
319 pass |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
320 elif dirtyc1: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
321 # 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
|
322 assert not both2['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
323 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
|
324 bothincompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
325 elif dirtyc2: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
326 assert not both1['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
327 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
|
328 bothincompletediverge) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
329 else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
330 # 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
|
331 assert not both1['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
332 assert not both2['incomplete'] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
333 assert not bothincompletediverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
334 for f in remainder: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
335 assert f not in bothdiverge |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
336 ic = remainder[f] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
337 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
|
338 # 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
|
339 bothdiverge[f] = ic |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
340 for of, fl in bothdiverge.items(): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
341 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
|
342 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
|
343 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
344 if fullcopy and repo.ui.debugflag: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
345 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
|
346 "% = renamed and deleted):\n") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
347 for f in sorted(fullcopy): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
348 note = "" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
349 if f in copy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
350 note += "*" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
351 if f in divergeset: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
352 note += "!" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
353 if f in renamedeleteset: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
354 note += "%" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
355 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
|
356 note)) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
357 del divergeset |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
358 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
359 if not fullcopy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
360 return copy, {}, diverge, renamedelete, {} |
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 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
|
363 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
364 # generate a directory move map |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
365 d1, d2 = c1.dirs(), c2.dirs() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
366 # 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
|
367 d1.addpath('/') |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
368 d2.addpath('/') |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
369 invalid = set() |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
370 dirmove = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
371 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
372 # 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
|
373 # 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
|
374 for dst, src in fullcopy.iteritems(): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
375 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
|
376 if dsrc in invalid: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
377 # already seen to be uninteresting |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
378 continue |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
379 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
|
380 # directory wasn't entirely moved locally |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
381 invalid.add(dsrc + "/") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
382 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
|
383 # directory wasn't entirely moved remotely |
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 dirmove and dirmove[dsrc + "/"] != ddst + "/": |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
386 # 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
|
387 invalid.add(dsrc + "/") |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
388 else: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
389 # looks good so far |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
390 dirmove[dsrc + "/"] = ddst + "/" |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
391 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
392 for i in invalid: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
393 if i in dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
394 del dirmove[i] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
395 del d1, d2, invalid |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
396 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
397 if not dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
398 return copy, {}, diverge, renamedelete, {} |
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 for d in dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
401 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
|
402 (d, dirmove[d])) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
403 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
404 movewithdir = {} |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
405 # 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
|
406 for f in u1r + u2r: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
407 if f not in fullcopy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
408 for d in dirmove: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
409 if f.startswith(d): |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
410 # 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
|
411 df = dirmove[d] + f[len(d):] |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
412 if df not in copy: |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
413 movewithdir[f] = df |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
414 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
|
415 "dst: '%s'\n") % (f, df)) |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
416 break |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
417 |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
418 return copy, movewithdir, diverge, renamedelete, dirmove |
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
419 |
4439
2eafdca7ba4b
evolve: preserve compatibility for hg < 4.8 versions
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4429
diff
changeset
|
420 # hg <= 4.9 compat (7694b685bb10) |
2eafdca7ba4b
evolve: preserve compatibility for hg < 4.8 versions
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4429
diff
changeset
|
421 fixupstreamed = util.safehasattr(scmutil, '_movedirstate') |
2eafdca7ba4b
evolve: preserve compatibility for hg < 4.8 versions
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
4429
diff
changeset
|
422 if not fixupstreamed: |
3882
55b8c7e7e352
compat: temporarily move copies fix to compat.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3767
diff
changeset
|
423 copies._fullcopytracing = fixedcopytracing |
3932
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
424 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
425 if not util.safehasattr(obsutil, "_succs"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
426 class _succs(list): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
427 """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
|
428 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
429 def __init__(self, *args, **kwargs): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
430 super(_succs, self).__init__(*args, **kwargs) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
431 self.markers = set() |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
432 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
433 def copy(self): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
434 new = _succs(self) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
435 new.markers = self.markers.copy() |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
436 return new |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
437 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
438 @util.propertycache |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
439 def _set(self): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
440 # immutable |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
441 return set(self) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
442 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
443 def canmerge(self, other): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
444 return self._set.issubset(other._set) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
445 else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
446 from mercurial.obsutil import _succs |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
447 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
448 def wrap_succs(succs): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
449 """ 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
|
450 _succs instance |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
451 """ |
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 if not util.safehasattr(succs, "markers"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
454 return _succs(succs) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
455 else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
456 return succs |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
457 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
458 if not util.safehasattr(obsutil, "markersdates"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
459 MARKERS_DATE_COMPAT = True |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
460 else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
461 MARKERS_DATE_COMPAT = False |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
462 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
463 def markersdates(markers): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
464 """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
|
465 """ |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
466 if MARKERS_DATE_COMPAT is False: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
467 return obsutil.markersdates(markers) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
468 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
469 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
|
470 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
471 if not util.safehasattr(obsutil, "markersusers"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
472 MARKERS_USERS_COMPAT = True |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
473 else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
474 MARKERS_USERS_COMPAT = False |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
475 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
476 def markersusers(markers): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
477 """ 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
|
478 """ |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
479 if MARKERS_USERS_COMPAT is False: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
480 return obsutil.markersusers(markers) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
481 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
482 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
|
483 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
|
484 if meta.get('user')) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
485 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
486 return sorted(users) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
487 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
488 if not util.safehasattr(obsutil, "markersoperations"): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
489 MARKERS_OPERATIONS_COMPAT = True |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
490 else: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
491 MARKERS_OPERATIONS_COMPAT = False |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
492 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
493 def markersoperations(markers): |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
494 """ 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
|
495 """ |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
496 if MARKERS_OPERATIONS_COMPAT is False: |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
497 return obsutil.markersoperations(markers) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
498 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
499 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
|
500 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
|
501 if meta.get('operation')) |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
502 |
35b2d201eb71
compat: fix obslog compatiblity with 4.3
Boris Feld <boris.feld@octobus.net>
parents:
3931
diff
changeset
|
503 return sorted(operations) |