82 |
82 |
83 def _nothingtorebase(): |
83 def _nothingtorebase(): |
84 return 1 |
84 return 1 |
85 |
85 |
86 |
86 |
87 graft_extras = b'source', b'intermediate-source' |
87 def retained_extras(): |
|
88 """ |
|
89 Yield the names of the extras to be retained. |
|
90 """ |
|
91 # graft |
|
92 yield b'source' |
|
93 yield b'intermediate-source' |
88 |
94 |
89 |
95 |
90 def _project(orig, names): |
96 def _project(orig, names): |
91 """Project a subset of names from orig.""" |
97 """Project a subset of names from orig.""" |
92 values = (orig.get(name, None) for name in names) |
98 names_saved = tuple(names) |
|
99 values = (orig.get(name, None) for name in names_saved) |
93 return { |
100 return { |
94 name: value for name, value in zip(names, values) if value is not None |
101 name: value |
|
102 for name, value in zip(names_saved, values) |
|
103 if value is not None |
95 } |
104 } |
96 |
105 |
97 |
106 |
98 def _savegraft(ctx, extra): |
107 def _save_extras(ctx, extra): |
99 extra.update(_project(ctx.extra(), graft_extras)) |
108 extra.update(_project(ctx.extra(), retained_extras())) |
100 |
109 |
101 |
110 |
102 def _savebranch(ctx, extra): |
111 def _savebranch(ctx, extra): |
103 extra[b'branch'] = ctx.branch() |
112 extra[b'branch'] = ctx.branch() |
104 |
113 |
197 self.collapsef = opts.get('collapse', False) |
206 self.collapsef = opts.get('collapse', False) |
198 self.collapsemsg = cmdutil.logmessage(ui, pycompat.byteskwargs(opts)) |
207 self.collapsemsg = cmdutil.logmessage(ui, pycompat.byteskwargs(opts)) |
199 self.date = opts.get('date', None) |
208 self.date = opts.get('date', None) |
200 |
209 |
201 e = opts.get('extrafn') # internal, used by e.g. hgsubversion |
210 e = opts.get('extrafn') # internal, used by e.g. hgsubversion |
202 self.extrafns = [_savegraft] |
211 self.extrafns = [_save_extras] |
203 if e: |
212 if e: |
204 self.extrafns = [e] |
213 self.extrafns = [e] |
205 |
214 |
206 self.backupf = ui.configbool(b'rewrite', b'backup-bundle') |
215 self.backupf = ui.configbool(b'rewrite', b'backup-bundle') |
207 self.keepf = opts.get('keep', False) |
216 self.keepf = opts.get('keep', False) |