52 return False |
51 return False |
53 return util.safehasattr(obsutil, 'obsfateprinter') |
52 return util.safehasattr(obsutil, 'obsfateprinter') |
54 |
53 |
55 # Evolution renaming compat |
54 # Evolution renaming compat |
56 |
55 |
57 TROUBLES = {} |
56 TROUBLES = { |
58 |
57 'ORPHAN': 'orphan', |
59 if not util.safehasattr(context.basectx, 'orphan'): |
58 'CONTENTDIVERGENT': 'content-divergent', |
60 TROUBLES['ORPHAN'] = 'unstable' |
59 'PHASEDIVERGENT': 'phase-divergent', |
61 context.basectx.orphan = context.basectx.unstable |
60 } |
62 else: |
|
63 TROUBLES['ORPHAN'] = 'orphan' |
|
64 |
|
65 if not util.safehasattr(context.basectx, 'contentdivergent'): |
|
66 TROUBLES['CONTENTDIVERGENT'] = 'divergent' |
|
67 context.basectx.contentdivergent = context.basectx.divergent |
|
68 else: |
|
69 TROUBLES['CONTENTDIVERGENT'] = 'content-divergent' |
|
70 |
|
71 if not util.safehasattr(context.basectx, 'phasedivergent'): |
|
72 TROUBLES['PHASEDIVERGENT'] = 'bumped' |
|
73 context.basectx.phasedivergent = context.basectx.bumped |
|
74 else: |
|
75 TROUBLES['PHASEDIVERGENT'] = 'phase-divergent' |
|
76 |
|
77 if not util.safehasattr(context.basectx, 'isunstable'): |
|
78 context.basectx.isunstable = context.basectx.troubled |
|
79 |
|
80 if not util.safehasattr(revset, 'orphan'): |
|
81 @eh.revsetpredicate('orphan') |
|
82 def oprhanrevset(*args, **kwargs): |
|
83 return revset.unstable(*args, **kwargs) |
|
84 |
|
85 if not util.safehasattr(revset, 'contentdivergent'): |
|
86 @eh.revsetpredicate('contentdivergent') |
|
87 def contentdivergentrevset(*args, **kwargs): |
|
88 return revset.divergent(*args, **kwargs) |
|
89 |
|
90 if not util.safehasattr(revset, 'phasedivergent'): |
|
91 @eh.revsetpredicate('phasedivergent') |
|
92 def phasedivergentrevset(*args, **kwargs): |
|
93 return revset.bumped(*args, **kwargs) |
|
94 |
61 |
95 if util.safehasattr(uimod.ui, 'makeprogress'): |
62 if util.safehasattr(uimod.ui, 'makeprogress'): |
96 def progress(ui, topic, pos, item="", unit="", total=None): |
63 def progress(ui, topic, pos, item="", unit="", total=None): |
97 progress = ui.makeprogress(topic, unit, total) |
64 progress = ui.makeprogress(topic, unit, total) |
98 if pos is not None: |
65 if pos is not None: |
101 progress.complete() |
68 progress.complete() |
102 else: |
69 else: |
103 def progress(ui, topic, pos, item="", unit="", total=None): |
70 def progress(ui, topic, pos, item="", unit="", total=None): |
104 ui.progress(topic, pos, item="", unit="", total=None) |
71 ui.progress(topic, pos, item="", unit="", total=None) |
105 |
72 |
106 if not util.safehasattr(context.basectx, 'instabilities'): |
|
107 def instabilities(self): |
|
108 """return the list of instabilities affecting this changeset. |
|
109 |
|
110 Instabilities are returned as strings. possible values are: |
|
111 - orphan, |
|
112 - phase-divergent, |
|
113 - content-divergent. |
|
114 """ |
|
115 instabilities = [] |
|
116 if self.orphan(): |
|
117 instabilities.append('orphan') |
|
118 if self.phasedivergent(): |
|
119 instabilities.append('phase-divergent') |
|
120 if self.contentdivergent(): |
|
121 instabilities.append('content-divergent') |
|
122 return instabilities |
|
123 |
|
124 context.basectx.instabilities = instabilities |
|
125 |
|
126 # XXX: Better detection of property cache |
73 # XXX: Better detection of property cache |
127 if 'predecessors' not in dir(obsolete.obsstore): |
74 if 'predecessors' not in dir(obsolete.obsstore): |
128 @property |
75 @property |
129 def predecessors(self): |
76 def predecessors(self): |
130 return self.precursors |
77 return self.precursors |
131 |
78 |
132 obsolete.obsstore.predecessors = predecessors |
79 obsolete.obsstore.predecessors = predecessors |
133 |
|
134 if not util.safehasattr(obsolete, '_computeorphanset'): |
|
135 obsolete._computeorphanset = obsolete.cachefor('orphan')(obsolete._computeunstableset) |
|
136 |
|
137 if not util.safehasattr(obsolete, '_computecontentdivergentset'): |
|
138 obsolete._computecontentdivergentset = obsolete.cachefor('contentdivergent')(obsolete._computedivergentset) |
|
139 |
|
140 if not util.safehasattr(obsolete, '_computephasedivergentset'): |
|
141 obsolete._computephasedivergentset = obsolete.cachefor('phasedivergent')(obsolete._computebumpedset) |
|
142 |
80 |
143 def memfilectx(repo, ctx, fctx, flags, copied, path): |
81 def memfilectx(repo, ctx, fctx, flags, copied, path): |
144 # XXX Would it be better at the module level? |
82 # XXX Would it be better at the module level? |
145 varnames = context.memfilectx.__init__.__code__.co_varnames |
83 varnames = context.memfilectx.__init__.__code__.co_varnames |
146 ctxmandatory = varnames[2] == "changectx" |
84 ctxmandatory = varnames[2] == "changectx" |