Same motivation is previous patch.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Same motivation is previous patch.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/debugcommands.py (14 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| id = 0 | id = 0 | ||||
| ui.progress(_('building'), id, unit=_('revisions'), total=total) | ui.progress(_('building'), id, unit=_('revisions'), total=total) | ||||
| for type, data in dagparser.parsedag(text): | for type, data in dagparser.parsedag(text): | ||||
| if type == 'n': | if type == 'n': | ||||
| ui.note(('node %s\n' % str(data))) | ui.note(('node %s\n' % str(data))) | ||||
| id, ps = data | id, ps = data | ||||
| files = [] | files = [] | ||||
| fctxs = {} | filecontent = {} | ||||
| p2 = None | p2 = None | ||||
| if mergeable_file: | if mergeable_file: | ||||
| fn = "mf" | fn = "mf" | ||||
| p1 = repo[ps[0]] | p1 = repo[ps[0]] | ||||
| if len(ps) > 1: | if len(ps) > 1: | ||||
| p2 = repo[ps[1]] | p2 = repo[ps[1]] | ||||
| pa = p1.ancestor(p2) | pa = p1.ancestor(p2) | ||||
| base, local, other = [x[fn].data() for x in (pa, p1, | base, local, other = [x[fn].data() for x in (pa, p1, | ||||
| p2)] | p2)] | ||||
| m3 = simplemerge.Merge3Text(base, local, other) | m3 = simplemerge.Merge3Text(base, local, other) | ||||
| ml = [l.strip() for l in m3.merge_lines()] | ml = [l.strip() for l in m3.merge_lines()] | ||||
| ml.append("") | ml.append("") | ||||
| elif at > 0: | elif at > 0: | ||||
| ml = p1[fn].data().split("\n") | ml = p1[fn].data().split("\n") | ||||
| else: | else: | ||||
| ml = initialmergedlines | ml = initialmergedlines | ||||
| ml[id * linesperrev] += " r%i" % id | ml[id * linesperrev] += " r%i" % id | ||||
| mergedtext = "\n".join(ml) | mergedtext = "\n".join(ml) | ||||
| files.append(fn) | files.append(fn) | ||||
| fctxs[fn] = context.memfilectx(repo, fn, mergedtext) | filecontent[fn] = mergedtext | ||||
| if overwritten_file: | if overwritten_file: | ||||
| fn = "of" | fn = "of" | ||||
| files.append(fn) | files.append(fn) | ||||
| fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | filecontent[fn] = "r%i\n" % id | ||||
| if new_file: | if new_file: | ||||
| fn = "nf%i" % id | fn = "nf%i" % id | ||||
| files.append(fn) | files.append(fn) | ||||
| fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | filecontent[fn] = "r%i\n" % id | ||||
| if len(ps) > 1: | if len(ps) > 1: | ||||
| if not p2: | if not p2: | ||||
| p2 = repo[ps[1]] | p2 = repo[ps[1]] | ||||
| for fn in p2: | for fn in p2: | ||||
| if fn.startswith("nf"): | if fn.startswith("nf"): | ||||
| files.append(fn) | files.append(fn) | ||||
| fctxs[fn] = p2[fn] | filecontent[fn] = p2[fn].data() | ||||
| def fctxfn(repo, cx, path): | def fctxfn(repo, cx, path): | ||||
| return fctxs.get(path) | if path in filecontent: | ||||
| return context.memfilectx(repo, path, filecontent[path]) | |||||
| return None | |||||
| if len(ps) == 0 or ps[0] < 0: | if len(ps) == 0 or ps[0] < 0: | ||||
| pars = [None, None] | pars = [None, None] | ||||
| elif len(ps) == 1: | elif len(ps) == 1: | ||||
| pars = [nodeids[ps[0]], None] | pars = [nodeids[ps[0]], None] | ||||
| else: | else: | ||||
| pars = [nodeids[p] for p in ps] | pars = [nodeids[p] for p in ps] | ||||
| cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, | ||||