def diffordiffstat(ui, repo, diffopts, node1, node2, match, changes=None, stat=False, fp=None, prefix='', listsubrepos=False): '''show diff or diffstat.''' if fp is None: write = ui.write else: def write(s, **kw): fp.write(s) if stat: diffopts = diffopts.copy(context=0) width = 80 if not ui.plain(): width = ui.termwidth() chunks = patch.diff(repo, node1, node2, match, changes, diffopts, prefix=prefix) for chunk, label in patch.diffstatui(util.iterlines(chunks), width=width, git=diffopts.git): write(chunk, label=label) else: for chunk, label in patch.diffui(repo, node1, node2, match, changes, diffopts, prefix=prefix): write(chunk, label=label) if listsubrepos: ctx1 = repo[node1] ctx2 = repo[node2] for subpath, sub in subrepo.itersubrepos(ctx1, ctx2): if node2 is not None: node2 = ctx2.substate[subpath][1] submatch = matchmod.narrowmatcher(subpath, match) sub.diff(diffopts, node2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix)
def showdiffstat(repo, ctx, templ, **args): """:diffstat: String. Statistics of changes with the following format: "modified files: +added/-removed lines" """ stats = patch.diffstatdata(util.iterlines(ctx.diff())) maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats) return '%s: +%s/-%s' % (len(stats), adds, removes)
def showdiffstat(repo, ctx, templ, **args): files, adds, removes = 0, 0, 0 for i in patch.diffstatdata(util.iterlines(ctx.diff())): files += 1 adds += i[1] removes += i[2] return '%s: +%s/-%s' % (files, adds, removes)
def showdiffstat(**args): diff = patch.diff(self.repo, ctx.parents()[0].node(), ctx.node()) files, adds, removes = 0, 0, 0 for i in patch.diffstatdata(util.iterlines(diff)): files += 1 adds += i[1] removes += i[2] return '%s: +%s/-%s' % (files, adds, removes)
def showdiffstat(repo, ctx, templ, **args): diff = patch.diff(repo, ctx.parents()[0].node(), ctx.node()) files, adds, removes = 0, 0, 0 for i in patch.diffstatdata(util.iterlines(diff)): files += 1 adds += i[1] removes += i[2] return '%s: +%s/-%s' % (files, adds, removes)
def diffordiffstat(ui, repo, diffopts, node1, node2, match, changes=None, stat=False, fp=None, prefix='', listsubrepos=False): '''show diff or diffstat.''' if fp is None: write = ui.write else: def write(s, **kw): fp.write(s) if stat: diffopts = diffopts.copy(context=0) width = 80 if not ui.plain(): width = ui.termwidth() chunks = patch.diff(repo, node1, node2, match, changes, diffopts, prefix=prefix) for chunk, label in patch.diffstatui(util.iterlines(chunks), width=width, git=diffopts.git): write(chunk, label=label) else: for chunk, label in patch.diffui(repo, node1, node2, match, changes, diffopts, prefix=prefix): write(chunk, label=label) if listsubrepos: ctx1 = repo[node1] ctx2 = repo[node2] for subpath, sub in subrepo.itersubrepos(ctx1, ctx2): tempnode2 = node2 try: if node2 is not None: tempnode2 = ctx2.substate[subpath][1] except KeyError: # A subrepo that existed in node1 was deleted between node1 and # node2 (inclusive). Thus, ctx2's substate won't contain that # subpath. The best we can do is to ignore it. tempnode2 = None submatch = matchmod.narrowmatcher(subpath, match) sub.diff(diffopts, tempnode2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix)