Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

hgqt: qtlib.difflabel no longer necessary

I've pushed a change to mercurial that allows our htmlui to always
know when it is safe to escape a message. Since I can remove the
hacks from htmlui, we no longer need a special copy of difflabel that
always emits labeled text.

Changeset 316ae123a413

Parent d3f7a37ae41b

by Steve Borho

Changes to 4 files · Browse files at 316ae123a413 Showing diff from parent d3f7a37ae41b Diff from another changeset...

 
87
88
89
90
 
91
92
93
 
87
88
89
 
90
91
92
93
@@ -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
273
274
275
 
276
277
278
 
272
273
274
 
275
276
277
278
@@ -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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
 
96
97
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
100
101
@@ -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
413
414
415
 
416
417
418
 
432
433
434
435
 
436
437
438
 
412
413
414
 
415
416
417
418
 
432
433
434
 
435
436
437
438
@@ -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: