Changeset 316ae123a413…
Parent d3f7a37ae41b…
by
Changes to 4 files · Browse files at 316ae123a413 Showing diff from parent d3f7a37ae41b Diff from another changeset...
@@ -87,7 +87,7 @@ ui.pushbuffer()
chunk.write(ui)
data = ui.popbuffer()
- for a, l in qtlib.difflabel(data.splitlines, True):
+ for a, l in patch.difflabel(data.splitlines, True):
hu.write(a, label=l)
o, e = hu.getdata()
items.append(o)
|
@@ -272,7 +272,7 @@ t = _('%s and %s have identical contents\n\n') % (src, dest)
hu.write(t, label='ui.error')
else:
- for t, l in qtlib.difflabel(difftext.splitlines, True):
+ for t, l in patch.difflabel(difftext.splitlines, True):
hu.write(t, label=l)
self.difftb.setHtml(hu.getdata()[0])
|
@@ -96,41 +96,6 @@ return ';'.join(effects)
-# Copy of patch.difflabel from Mercurial, hacked to always return
-# a label for unmatched text, so it gets escaped by our htmlui
-def difflabel(func, *args, **kw):
- '''yields 2-tuples of (output, label) based on the output of func()'''
- prefixes = [('diff', 'diff.diffline'),
- ('copy', 'diff.extended'),
- ('rename', 'diff.extended'),
- ('old', 'diff.extended'),
- ('new', 'diff.extended'),
- ('deleted', 'diff.extended'),
- ('---', 'diff.file_a'),
- ('+++', 'diff.file_b'),
- ('@@', 'diff.hunk'),
- ('-', 'diff.deleted'),
- ('+', 'diff.inserted')]
-
- for chunk in func(*args, **kw):
- lines = chunk.split('\n')
- for i, line in enumerate(lines):
- if i != 0:
- yield ('\n', '')
- stripline = line
- if line and line[0] in '+-':
- # highlight trailing whitespace, but only in changed lines
- stripline = line.rstrip()
- for prefix, label in prefixes:
- if stripline.startswith(prefix):
- yield (stripline, label)
- break
- else:
- yield (line, 'ui.status')
- if line != stripline:
- yield (line[len(stripline):], 'diff.trailingwhitespace')
-
-
NAME_MAP = {
'fg': 'color', 'bg': 'background-color', 'family': 'font-family',
'size': 'font-size', 'weight': 'font-weight', 'space': 'white-space',
|
@@ -412,7 +412,7 @@ # Generate diffs to first parent
m = cmdutil.matchfiles(self.repo, [wfile])
try:
- for s, l in qtlib.difflabel(self.wctx.diff, match=m, git=True):
+ for s, l in patch.difflabel(self.wctx.diff, match=m, git=True):
hu.write(s, label=l)
except (IOError, error.RepoError, error.LookupError, util.Abort), e:
err = hglib.tounicode(str(e))
@@ -432,7 +432,7 @@
# Generate diffs to second parent
try:
- for s, l in qtlib.difflabel(self.wctx.diff, self.wctx.p2(),
+ for s, l in patch.difflabel(self.wctx.diff, self.wctx.p2(),
match=m, git=True):
hu.write(s, label=l)
except (IOError, error.RepoError, error.LookupError, util.Abort), e:
|
Loading...