##// END OF EJS Templates
hgk: remove a "b" used on a kwargs expansion, the keys are strs...
Kyle Lippincott -
r45167:1756f758 default
parent child Browse files
Show More
@@ -1,387 +1,387 b''
1 # Minimal support for git commands on an hg repository
1 # Minimal support for git commands on an hg repository
2 #
2 #
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
3 # Copyright 2005, 2006 Chris Mason <mason@suse.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 '''browse the repository in a graphical way
8 '''browse the repository in a graphical way
9
9
10 The hgk extension allows browsing the history of a repository in a
10 The hgk extension allows browsing the history of a repository in a
11 graphical way. It requires Tcl/Tk version 8.4 or later. (Tcl/Tk is not
11 graphical way. It requires Tcl/Tk version 8.4 or later. (Tcl/Tk is not
12 distributed with Mercurial.)
12 distributed with Mercurial.)
13
13
14 hgk consists of two parts: a Tcl script that does the displaying and
14 hgk consists of two parts: a Tcl script that does the displaying and
15 querying of information, and an extension to Mercurial named hgk.py,
15 querying of information, and an extension to Mercurial named hgk.py,
16 which provides hooks for hgk to get information. hgk can be found in
16 which provides hooks for hgk to get information. hgk can be found in
17 the contrib directory, and the extension is shipped in the hgext
17 the contrib directory, and the extension is shipped in the hgext
18 repository, and needs to be enabled.
18 repository, and needs to be enabled.
19
19
20 The :hg:`view` command will launch the hgk Tcl script. For this command
20 The :hg:`view` command will launch the hgk Tcl script. For this command
21 to work, hgk must be in your search path. Alternately, you can specify
21 to work, hgk must be in your search path. Alternately, you can specify
22 the path to hgk in your configuration file::
22 the path to hgk in your configuration file::
23
23
24 [hgk]
24 [hgk]
25 path = /location/of/hgk
25 path = /location/of/hgk
26
26
27 hgk can make use of the extdiff extension to visualize revisions.
27 hgk can make use of the extdiff extension to visualize revisions.
28 Assuming you had already configured extdiff vdiff command, just add::
28 Assuming you had already configured extdiff vdiff command, just add::
29
29
30 [hgk]
30 [hgk]
31 vdiff=vdiff
31 vdiff=vdiff
32
32
33 Revisions context menu will now display additional entries to fire
33 Revisions context menu will now display additional entries to fire
34 vdiff on hovered and selected revisions.
34 vdiff on hovered and selected revisions.
35 '''
35 '''
36
36
37 from __future__ import absolute_import
37 from __future__ import absolute_import
38
38
39 import os
39 import os
40
40
41 from mercurial.i18n import _
41 from mercurial.i18n import _
42 from mercurial.node import (
42 from mercurial.node import (
43 nullid,
43 nullid,
44 nullrev,
44 nullrev,
45 short,
45 short,
46 )
46 )
47 from mercurial import (
47 from mercurial import (
48 commands,
48 commands,
49 obsolete,
49 obsolete,
50 patch,
50 patch,
51 pycompat,
51 pycompat,
52 registrar,
52 registrar,
53 scmutil,
53 scmutil,
54 )
54 )
55
55
56 cmdtable = {}
56 cmdtable = {}
57 command = registrar.command(cmdtable)
57 command = registrar.command(cmdtable)
58 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
58 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
59 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
59 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
60 # be specifying the version(s) of Mercurial they are tested with, or
60 # be specifying the version(s) of Mercurial they are tested with, or
61 # leave the attribute unspecified.
61 # leave the attribute unspecified.
62 testedwith = b'ships-with-hg-core'
62 testedwith = b'ships-with-hg-core'
63
63
64 configtable = {}
64 configtable = {}
65 configitem = registrar.configitem(configtable)
65 configitem = registrar.configitem(configtable)
66
66
67 configitem(
67 configitem(
68 b'hgk', b'path', default=b'hgk',
68 b'hgk', b'path', default=b'hgk',
69 )
69 )
70
70
71
71
72 @command(
72 @command(
73 b'debug-diff-tree',
73 b'debug-diff-tree',
74 [
74 [
75 (b'p', b'patch', None, _(b'generate patch')),
75 (b'p', b'patch', None, _(b'generate patch')),
76 (b'r', b'recursive', None, _(b'recursive')),
76 (b'r', b'recursive', None, _(b'recursive')),
77 (b'P', b'pretty', None, _(b'pretty')),
77 (b'P', b'pretty', None, _(b'pretty')),
78 (b's', b'stdin', None, _(b'stdin')),
78 (b's', b'stdin', None, _(b'stdin')),
79 (b'C', b'copy', None, _(b'detect copies')),
79 (b'C', b'copy', None, _(b'detect copies')),
80 (b'S', b'search', b"", _(b'search')),
80 (b'S', b'search', b"", _(b'search')),
81 ],
81 ],
82 b'[OPTION]... NODE1 NODE2 [FILE]...',
82 b'[OPTION]... NODE1 NODE2 [FILE]...',
83 inferrepo=True,
83 inferrepo=True,
84 )
84 )
85 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
85 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
86 """diff trees from two commits"""
86 """diff trees from two commits"""
87
87
88 def __difftree(repo, node1, node2, files=None):
88 def __difftree(repo, node1, node2, files=None):
89 assert node2 is not None
89 assert node2 is not None
90 if files is None:
90 if files is None:
91 files = []
91 files = []
92 mmap = repo[node1].manifest()
92 mmap = repo[node1].manifest()
93 mmap2 = repo[node2].manifest()
93 mmap2 = repo[node2].manifest()
94 m = scmutil.match(repo[node1], files)
94 m = scmutil.match(repo[node1], files)
95 st = repo.status(node1, node2, m)
95 st = repo.status(node1, node2, m)
96 empty = short(nullid)
96 empty = short(nullid)
97
97
98 for f in st.modified:
98 for f in st.modified:
99 # TODO get file permissions
99 # TODO get file permissions
100 ui.writenoi18n(
100 ui.writenoi18n(
101 b":100664 100664 %s %s M\t%s\t%s\n"
101 b":100664 100664 %s %s M\t%s\t%s\n"
102 % (short(mmap[f]), short(mmap2[f]), f, f)
102 % (short(mmap[f]), short(mmap2[f]), f, f)
103 )
103 )
104 for f in st.added:
104 for f in st.added:
105 ui.writenoi18n(
105 ui.writenoi18n(
106 b":000000 100664 %s %s N\t%s\t%s\n"
106 b":000000 100664 %s %s N\t%s\t%s\n"
107 % (empty, short(mmap2[f]), f, f)
107 % (empty, short(mmap2[f]), f, f)
108 )
108 )
109 for f in st.removed:
109 for f in st.removed:
110 ui.writenoi18n(
110 ui.writenoi18n(
111 b":100664 000000 %s %s D\t%s\t%s\n"
111 b":100664 000000 %s %s D\t%s\t%s\n"
112 % (short(mmap[f]), empty, f, f)
112 % (short(mmap[f]), empty, f, f)
113 )
113 )
114
114
115 ##
115 ##
116
116
117 while True:
117 while True:
118 if opts['stdin']:
118 if opts['stdin']:
119 line = ui.fin.readline()
119 line = ui.fin.readline()
120 if not line:
120 if not line:
121 break
121 break
122 line = line.rstrip(pycompat.oslinesep).split(b' ')
122 line = line.rstrip(pycompat.oslinesep).split(b' ')
123 node1 = line[0]
123 node1 = line[0]
124 if len(line) > 1:
124 if len(line) > 1:
125 node2 = line[1]
125 node2 = line[1]
126 else:
126 else:
127 node2 = None
127 node2 = None
128 node1 = repo.lookup(node1)
128 node1 = repo.lookup(node1)
129 if node2:
129 if node2:
130 node2 = repo.lookup(node2)
130 node2 = repo.lookup(node2)
131 else:
131 else:
132 node2 = node1
132 node2 = node1
133 node1 = repo.changelog.parents(node1)[0]
133 node1 = repo.changelog.parents(node1)[0]
134 if opts['patch']:
134 if opts['patch']:
135 if opts['pretty']:
135 if opts['pretty']:
136 catcommit(ui, repo, node2, b"")
136 catcommit(ui, repo, node2, b"")
137 m = scmutil.match(repo[node1], files)
137 m = scmutil.match(repo[node1], files)
138 diffopts = patch.difffeatureopts(ui)
138 diffopts = patch.difffeatureopts(ui)
139 diffopts.git = True
139 diffopts.git = True
140 chunks = patch.diff(repo, node1, node2, match=m, opts=diffopts)
140 chunks = patch.diff(repo, node1, node2, match=m, opts=diffopts)
141 for chunk in chunks:
141 for chunk in chunks:
142 ui.write(chunk)
142 ui.write(chunk)
143 else:
143 else:
144 __difftree(repo, node1, node2, files=files)
144 __difftree(repo, node1, node2, files=files)
145 if not opts['stdin']:
145 if not opts['stdin']:
146 break
146 break
147
147
148
148
149 def catcommit(ui, repo, n, prefix, ctx=None):
149 def catcommit(ui, repo, n, prefix, ctx=None):
150 nlprefix = b'\n' + prefix
150 nlprefix = b'\n' + prefix
151 if ctx is None:
151 if ctx is None:
152 ctx = repo[n]
152 ctx = repo[n]
153 # use ctx.node() instead ??
153 # use ctx.node() instead ??
154 ui.write((b"tree %s\n" % short(ctx.changeset()[0])))
154 ui.write((b"tree %s\n" % short(ctx.changeset()[0])))
155 for p in ctx.parents():
155 for p in ctx.parents():
156 ui.write((b"parent %s\n" % p))
156 ui.write((b"parent %s\n" % p))
157
157
158 date = ctx.date()
158 date = ctx.date()
159 description = ctx.description().replace(b"\0", b"")
159 description = ctx.description().replace(b"\0", b"")
160 ui.write((b"author %s %d %d\n" % (ctx.user(), int(date[0]), date[1])))
160 ui.write((b"author %s %d %d\n" % (ctx.user(), int(date[0]), date[1])))
161
161
162 if b'committer' in ctx.extra():
162 if b'committer' in ctx.extra():
163 ui.write((b"committer %s\n" % ctx.extra()[b'committer']))
163 ui.write((b"committer %s\n" % ctx.extra()[b'committer']))
164
164
165 ui.write((b"revision %d\n" % ctx.rev()))
165 ui.write((b"revision %d\n" % ctx.rev()))
166 ui.write((b"branch %s\n" % ctx.branch()))
166 ui.write((b"branch %s\n" % ctx.branch()))
167 if obsolete.isenabled(repo, obsolete.createmarkersopt):
167 if obsolete.isenabled(repo, obsolete.createmarkersopt):
168 if ctx.obsolete():
168 if ctx.obsolete():
169 ui.writenoi18n(b"obsolete\n")
169 ui.writenoi18n(b"obsolete\n")
170 ui.write((b"phase %s\n\n" % ctx.phasestr()))
170 ui.write((b"phase %s\n\n" % ctx.phasestr()))
171
171
172 if prefix != b"":
172 if prefix != b"":
173 ui.write(
173 ui.write(
174 b"%s%s\n" % (prefix, description.replace(b'\n', nlprefix).strip())
174 b"%s%s\n" % (prefix, description.replace(b'\n', nlprefix).strip())
175 )
175 )
176 else:
176 else:
177 ui.write(description + b"\n")
177 ui.write(description + b"\n")
178 if prefix:
178 if prefix:
179 ui.write(b'\0')
179 ui.write(b'\0')
180
180
181
181
182 @command(b'debug-merge-base', [], _(b'REV REV'))
182 @command(b'debug-merge-base', [], _(b'REV REV'))
183 def base(ui, repo, node1, node2):
183 def base(ui, repo, node1, node2):
184 """output common ancestor information"""
184 """output common ancestor information"""
185 node1 = repo.lookup(node1)
185 node1 = repo.lookup(node1)
186 node2 = repo.lookup(node2)
186 node2 = repo.lookup(node2)
187 n = repo.changelog.ancestor(node1, node2)
187 n = repo.changelog.ancestor(node1, node2)
188 ui.write(short(n) + b"\n")
188 ui.write(short(n) + b"\n")
189
189
190
190
191 @command(
191 @command(
192 b'debug-cat-file',
192 b'debug-cat-file',
193 [(b's', b'stdin', None, _(b'stdin'))],
193 [(b's', b'stdin', None, _(b'stdin'))],
194 _(b'[OPTION]... TYPE FILE'),
194 _(b'[OPTION]... TYPE FILE'),
195 inferrepo=True,
195 inferrepo=True,
196 )
196 )
197 def catfile(ui, repo, type=None, r=None, **opts):
197 def catfile(ui, repo, type=None, r=None, **opts):
198 """cat a specific revision"""
198 """cat a specific revision"""
199 # in stdin mode, every line except the commit is prefixed with two
199 # in stdin mode, every line except the commit is prefixed with two
200 # spaces. This way the our caller can find the commit without magic
200 # spaces. This way the our caller can find the commit without magic
201 # strings
201 # strings
202 #
202 #
203 prefix = b""
203 prefix = b""
204 if opts['stdin']:
204 if opts['stdin']:
205 line = ui.fin.readline()
205 line = ui.fin.readline()
206 if not line:
206 if not line:
207 return
207 return
208 (type, r) = line.rstrip(pycompat.oslinesep).split(b' ')
208 (type, r) = line.rstrip(pycompat.oslinesep).split(b' ')
209 prefix = b" "
209 prefix = b" "
210 else:
210 else:
211 if not type or not r:
211 if not type or not r:
212 ui.warn(_(b"cat-file: type or revision not supplied\n"))
212 ui.warn(_(b"cat-file: type or revision not supplied\n"))
213 commands.help_(ui, b'cat-file')
213 commands.help_(ui, b'cat-file')
214
214
215 while r:
215 while r:
216 if type != b"commit":
216 if type != b"commit":
217 ui.warn(_(b"aborting hg cat-file only understands commits\n"))
217 ui.warn(_(b"aborting hg cat-file only understands commits\n"))
218 return 1
218 return 1
219 n = repo.lookup(r)
219 n = repo.lookup(r)
220 catcommit(ui, repo, n, prefix)
220 catcommit(ui, repo, n, prefix)
221 if opts['stdin']:
221 if opts['stdin']:
222 line = ui.fin.readline()
222 line = ui.fin.readline()
223 if not line:
223 if not line:
224 break
224 break
225 (type, r) = line.rstrip(pycompat.oslinesep).split(b' ')
225 (type, r) = line.rstrip(pycompat.oslinesep).split(b' ')
226 else:
226 else:
227 break
227 break
228
228
229
229
230 # git rev-tree is a confusing thing. You can supply a number of
230 # git rev-tree is a confusing thing. You can supply a number of
231 # commit sha1s on the command line, and it walks the commit history
231 # commit sha1s on the command line, and it walks the commit history
232 # telling you which commits are reachable from the supplied ones via
232 # telling you which commits are reachable from the supplied ones via
233 # a bitmask based on arg position.
233 # a bitmask based on arg position.
234 # you can specify a commit to stop at by starting the sha1 with ^
234 # you can specify a commit to stop at by starting the sha1 with ^
235 def revtree(ui, args, repo, full=b"tree", maxnr=0, parents=False):
235 def revtree(ui, args, repo, full=b"tree", maxnr=0, parents=False):
236 def chlogwalk():
236 def chlogwalk():
237 count = len(repo)
237 count = len(repo)
238 i = count
238 i = count
239 l = [0] * 100
239 l = [0] * 100
240 chunk = 100
240 chunk = 100
241 while True:
241 while True:
242 if chunk > i:
242 if chunk > i:
243 chunk = i
243 chunk = i
244 i = 0
244 i = 0
245 else:
245 else:
246 i -= chunk
246 i -= chunk
247
247
248 for x in pycompat.xrange(chunk):
248 for x in pycompat.xrange(chunk):
249 if i + x >= count:
249 if i + x >= count:
250 l[chunk - x :] = [0] * (chunk - x)
250 l[chunk - x :] = [0] * (chunk - x)
251 break
251 break
252 if full is not None:
252 if full is not None:
253 if (i + x) in repo:
253 if (i + x) in repo:
254 l[x] = repo[i + x]
254 l[x] = repo[i + x]
255 l[x].changeset() # force reading
255 l[x].changeset() # force reading
256 else:
256 else:
257 if (i + x) in repo:
257 if (i + x) in repo:
258 l[x] = 1
258 l[x] = 1
259 for x in pycompat.xrange(chunk - 1, -1, -1):
259 for x in pycompat.xrange(chunk - 1, -1, -1):
260 if l[x] != 0:
260 if l[x] != 0:
261 yield (i + x, full is not None and l[x] or None)
261 yield (i + x, full is not None and l[x] or None)
262 if i == 0:
262 if i == 0:
263 break
263 break
264
264
265 # calculate and return the reachability bitmask for sha
265 # calculate and return the reachability bitmask for sha
266 def is_reachable(ar, reachable, sha):
266 def is_reachable(ar, reachable, sha):
267 if len(ar) == 0:
267 if len(ar) == 0:
268 return 1
268 return 1
269 mask = 0
269 mask = 0
270 for i in pycompat.xrange(len(ar)):
270 for i in pycompat.xrange(len(ar)):
271 if sha in reachable[i]:
271 if sha in reachable[i]:
272 mask |= 1 << i
272 mask |= 1 << i
273
273
274 return mask
274 return mask
275
275
276 reachable = []
276 reachable = []
277 stop_sha1 = []
277 stop_sha1 = []
278 want_sha1 = []
278 want_sha1 = []
279 count = 0
279 count = 0
280
280
281 # figure out which commits they are asking for and which ones they
281 # figure out which commits they are asking for and which ones they
282 # want us to stop on
282 # want us to stop on
283 for i, arg in enumerate(args):
283 for i, arg in enumerate(args):
284 if arg.startswith(b'^'):
284 if arg.startswith(b'^'):
285 s = repo.lookup(arg[1:])
285 s = repo.lookup(arg[1:])
286 stop_sha1.append(s)
286 stop_sha1.append(s)
287 want_sha1.append(s)
287 want_sha1.append(s)
288 elif arg != b'HEAD':
288 elif arg != b'HEAD':
289 want_sha1.append(repo.lookup(arg))
289 want_sha1.append(repo.lookup(arg))
290
290
291 # calculate the graph for the supplied commits
291 # calculate the graph for the supplied commits
292 for i, n in enumerate(want_sha1):
292 for i, n in enumerate(want_sha1):
293 reachable.append(set())
293 reachable.append(set())
294 visit = [n]
294 visit = [n]
295 reachable[i].add(n)
295 reachable[i].add(n)
296 while visit:
296 while visit:
297 n = visit.pop(0)
297 n = visit.pop(0)
298 if n in stop_sha1:
298 if n in stop_sha1:
299 continue
299 continue
300 for p in repo.changelog.parents(n):
300 for p in repo.changelog.parents(n):
301 if p not in reachable[i]:
301 if p not in reachable[i]:
302 reachable[i].add(p)
302 reachable[i].add(p)
303 visit.append(p)
303 visit.append(p)
304 if p in stop_sha1:
304 if p in stop_sha1:
305 continue
305 continue
306
306
307 # walk the repository looking for commits that are in our
307 # walk the repository looking for commits that are in our
308 # reachability graph
308 # reachability graph
309 for i, ctx in chlogwalk():
309 for i, ctx in chlogwalk():
310 if i not in repo:
310 if i not in repo:
311 continue
311 continue
312 n = repo.changelog.node(i)
312 n = repo.changelog.node(i)
313 mask = is_reachable(want_sha1, reachable, n)
313 mask = is_reachable(want_sha1, reachable, n)
314 if mask:
314 if mask:
315 parentstr = b""
315 parentstr = b""
316 if parents:
316 if parents:
317 pp = repo.changelog.parents(n)
317 pp = repo.changelog.parents(n)
318 if pp[0] != nullid:
318 if pp[0] != nullid:
319 parentstr += b" " + short(pp[0])
319 parentstr += b" " + short(pp[0])
320 if pp[1] != nullid:
320 if pp[1] != nullid:
321 parentstr += b" " + short(pp[1])
321 parentstr += b" " + short(pp[1])
322 if not full:
322 if not full:
323 ui.write(b"%s%s\n" % (short(n), parentstr))
323 ui.write(b"%s%s\n" % (short(n), parentstr))
324 elif full == b"commit":
324 elif full == b"commit":
325 ui.write(b"%s%s\n" % (short(n), parentstr))
325 ui.write(b"%s%s\n" % (short(n), parentstr))
326 catcommit(ui, repo, n, b' ', ctx)
326 catcommit(ui, repo, n, b' ', ctx)
327 else:
327 else:
328 (p1, p2) = repo.changelog.parents(n)
328 (p1, p2) = repo.changelog.parents(n)
329 (h, h1, h2) = map(short, (n, p1, p2))
329 (h, h1, h2) = map(short, (n, p1, p2))
330 (i1, i2) = map(repo.changelog.rev, (p1, p2))
330 (i1, i2) = map(repo.changelog.rev, (p1, p2))
331
331
332 date = ctx.date()[0]
332 date = ctx.date()[0]
333 ui.write(b"%s %s:%s" % (date, h, mask))
333 ui.write(b"%s %s:%s" % (date, h, mask))
334 mask = is_reachable(want_sha1, reachable, p1)
334 mask = is_reachable(want_sha1, reachable, p1)
335 if i1 != nullrev and mask > 0:
335 if i1 != nullrev and mask > 0:
336 ui.write(b"%s:%s " % (h1, mask)),
336 ui.write(b"%s:%s " % (h1, mask)),
337 mask = is_reachable(want_sha1, reachable, p2)
337 mask = is_reachable(want_sha1, reachable, p2)
338 if i2 != nullrev and mask > 0:
338 if i2 != nullrev and mask > 0:
339 ui.write(b"%s:%s " % (h2, mask))
339 ui.write(b"%s:%s " % (h2, mask))
340 ui.write(b"\n")
340 ui.write(b"\n")
341 if maxnr and count >= maxnr:
341 if maxnr and count >= maxnr:
342 break
342 break
343 count += 1
343 count += 1
344
344
345
345
346 # git rev-list tries to order things by date, and has the ability to stop
346 # git rev-list tries to order things by date, and has the ability to stop
347 # at a given commit without walking the whole repo. TODO add the stop
347 # at a given commit without walking the whole repo. TODO add the stop
348 # parameter
348 # parameter
349 @command(
349 @command(
350 b'debug-rev-list',
350 b'debug-rev-list',
351 [
351 [
352 (b'H', b'header', None, _(b'header')),
352 (b'H', b'header', None, _(b'header')),
353 (b't', b'topo-order', None, _(b'topo-order')),
353 (b't', b'topo-order', None, _(b'topo-order')),
354 (b'p', b'parents', None, _(b'parents')),
354 (b'p', b'parents', None, _(b'parents')),
355 (b'n', b'max-count', 0, _(b'max-count')),
355 (b'n', b'max-count', 0, _(b'max-count')),
356 ],
356 ],
357 b'[OPTION]... REV...',
357 b'[OPTION]... REV...',
358 )
358 )
359 def revlist(ui, repo, *revs, **opts):
359 def revlist(ui, repo, *revs, **opts):
360 """print revisions"""
360 """print revisions"""
361 if opts[b'header']:
361 if opts['header']:
362 full = b"commit"
362 full = b"commit"
363 else:
363 else:
364 full = None
364 full = None
365 copy = [x for x in revs]
365 copy = [x for x in revs]
366 revtree(ui, copy, repo, full, opts['max_count'], opts[r'parents'])
366 revtree(ui, copy, repo, full, opts['max_count'], opts[r'parents'])
367
367
368
368
369 @command(
369 @command(
370 b'view',
370 b'view',
371 [(b'l', b'limit', b'', _(b'limit number of changes displayed'), _(b'NUM'))],
371 [(b'l', b'limit', b'', _(b'limit number of changes displayed'), _(b'NUM'))],
372 _(b'[-l LIMIT] [REVRANGE]'),
372 _(b'[-l LIMIT] [REVRANGE]'),
373 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
373 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
374 )
374 )
375 def view(ui, repo, *etc, **opts):
375 def view(ui, repo, *etc, **opts):
376 """start interactive history viewer"""
376 """start interactive history viewer"""
377 opts = pycompat.byteskwargs(opts)
377 opts = pycompat.byteskwargs(opts)
378 os.chdir(repo.root)
378 os.chdir(repo.root)
379 optstr = b' '.join(
379 optstr = b' '.join(
380 [b'--%s %s' % (k, v) for k, v in pycompat.iteritems(opts) if v]
380 [b'--%s %s' % (k, v) for k, v in pycompat.iteritems(opts) if v]
381 )
381 )
382 if repo.filtername is None:
382 if repo.filtername is None:
383 optstr += b'--hidden'
383 optstr += b'--hidden'
384
384
385 cmd = ui.config(b"hgk", b"path") + b" %s %s" % (optstr, b" ".join(etc))
385 cmd = ui.config(b"hgk", b"path") + b" %s %s" % (optstr, b" ".join(etc))
386 ui.debug(b"running %s\n" % cmd)
386 ui.debug(b"running %s\n" % cmd)
387 ui.system(cmd, blockedtag=b'hgk_view')
387 ui.system(cmd, blockedtag=b'hgk_view')
General Comments 0
You need to be logged in to leave comments. Login now