equal
deleted
inserted
replaced
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com> |
3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com> |
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from __future__ import absolute_import |
|
9 |
8 |
10 import itertools |
9 import itertools |
11 import os |
10 import os |
12 import posixpath |
11 import posixpath |
13 |
12 |
226 fp=fp, |
225 fp=fp, |
227 prefix=subprefix, |
226 prefix=subprefix, |
228 ) |
227 ) |
229 |
228 |
230 |
229 |
231 class changesetdiffer(object): |
230 class changesetdiffer: |
232 """Generate diff of changeset with pre-configured filtering functions""" |
231 """Generate diff of changeset with pre-configured filtering functions""" |
233 |
232 |
234 def _makefilematcher(self, ctx): |
233 def _makefilematcher(self, ctx): |
235 return scmutil.matchall(ctx.repo()) |
234 return scmutil.matchall(ctx.repo()) |
236 |
235 |
260 for instability in ctx.instabilities(): |
259 for instability in ctx.instabilities(): |
261 labels.append(b'instability.%s' % instability) |
260 labels.append(b'instability.%s' % instability) |
262 return b' '.join(labels) |
261 return b' '.join(labels) |
263 |
262 |
264 |
263 |
265 class changesetprinter(object): |
264 class changesetprinter: |
266 '''show changeset information when templating not requested.''' |
265 '''show changeset information when templating not requested.''' |
267 |
266 |
268 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False): |
267 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False): |
269 self.ui = ui |
268 self.ui = ui |
270 self.repo = repo |
269 self.repo = repo |
326 branch = ctx.branch() |
325 branch = ctx.branch() |
327 # don't show the default branch name |
326 # don't show the default branch name |
328 if branch != b'default': |
327 if branch != b'default': |
329 self.ui.write(columns[b'branch'] % branch, label=b'log.branch') |
328 self.ui.write(columns[b'branch'] % branch, label=b'log.branch') |
330 |
329 |
331 for nsname, ns in pycompat.iteritems(self.repo.names): |
330 for nsname, ns in self.repo.names.items(): |
332 # branches has special logic already handled above, so here we just |
331 # branches has special logic already handled above, so here we just |
333 # skip it |
332 # skip it |
334 if nsname == b'branches': |
333 if nsname == b'branches': |
335 continue |
334 continue |
336 # we will use the templatename as the color name since those two |
335 # we will use the templatename as the color name since those two |
414 ) |
413 ) |
415 self.ui.write(description, label=b'ui.note log.description') |
414 self.ui.write(description, label=b'ui.note log.description') |
416 self.ui.write(b"\n\n") |
415 self.ui.write(b"\n\n") |
417 else: |
416 else: |
418 self.ui.write( |
417 self.ui.write( |
419 columns[b'summary'] % description.splitlines()[0], |
418 columns[b'summary'] % stringutil.firstline(description), |
420 label=b'log.summary', |
419 label=b'log.summary', |
421 ) |
420 ) |
422 self.ui.write(b"\n") |
421 self.ui.write(b"\n") |
423 |
422 |
424 self._showpatch(ctx, graphwidth) |
423 self._showpatch(ctx, graphwidth) |
703 |
702 |
704 return changesettemplater(ui, repo, spec, *postargs) |
703 return changesettemplater(ui, repo, spec, *postargs) |
705 |
704 |
706 |
705 |
707 @attr.s |
706 @attr.s |
708 class walkopts(object): |
707 class walkopts: |
709 """Options to configure a set of revisions and file matcher factory |
708 """Options to configure a set of revisions and file matcher factory |
710 to scan revision/file history |
709 to scan revision/file history |
711 """ |
710 """ |
712 |
711 |
713 # raw command-line parameters, which a matcher will be built from |
712 # raw command-line parameters, which a matcher will be built from |
988 opts[b'_matchfiles'] = matchargs |
987 opts[b'_matchfiles'] = matchargs |
989 elif wopts.filter_revisions_by_pats and not wopts.follow: |
988 elif wopts.filter_revisions_by_pats and not wopts.follow: |
990 opts[b'_patslog'] = list(wopts.pats) |
989 opts[b'_patslog'] = list(wopts.pats) |
991 |
990 |
992 expr = [] |
991 expr = [] |
993 for op, val in sorted(pycompat.iteritems(opts)): |
992 for op, val in sorted(opts.items()): |
994 if not val: |
993 if not val: |
995 continue |
994 continue |
996 revop, listop = _opt2logrevset[op] |
995 revop, listop = _opt2logrevset[op] |
997 if revop and b'%' not in revop: |
996 if revop and b'%' not in revop: |
998 expr.append(revop) |
997 expr.append(revop) |