annotate contrib/hgk.py @ 1950:5f581f337b05

hgk "committer:" bug I've been having an hgk problem with this tree: http://xenbits.xensource.com/ext/linux-ppc-2.6.hg, specifically changeset 93c590d23a53. The problem seems to be that the commit message contains a "committer:" line, which triggers a (relatively unused?) case in hgk.py... Both cases need the dates at the end of the line.
author Hollis Blanchard <hollisb@us.ibm.com>
date Wed, 15 Mar 2006 03:19:16 +0100
parents f2b1df3dbcbb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1 # Minimal support for git commands on an hg repository
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
2 #
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
3 # Copyright 2005 Chris Mason <mason@suse.com>
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
4 #
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
5 # This software may be used and distributed according to the terms
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
6 # of the GNU General Public License, incorporated herein by reference.
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
7
1278
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
8 import time, sys, signal, os
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
9 from mercurial import hg, mdiff, fancyopts, commands, ui, util
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
10
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
11 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
12 changes=None, text=False):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
13 def date(c):
1344
ca0e27e05de3 Fix hgk for date handling changes
mpm@selenic.com
parents: 1308
diff changeset
14 return time.asctime(time.gmtime(c[2][0]))
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
15
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
16 if not changes:
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
17 changes = repo.changes(node1, node2, files, match=match)
1619
1ba0d7041ac4 Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1618
diff changeset
18 modified, added, removed, deleted, unknown = changes
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
19 if files:
1626
f2b1df3dbcbb make the order of the arguments for filterfiles consistent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1619
diff changeset
20 modified, added, removed = map(lambda x: filterfiles(files, x),
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
21 (modified, added, removed))
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
22
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
23 if not modified and not added and not removed:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
24 return
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
25
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
26 if node2:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
27 change = repo.changelog.read(node2)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
28 mmap2 = repo.manifest.read(change[0])
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
29 date2 = date(change)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
30 def read(f):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
31 return repo.file(f).read(mmap2[f])
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
32 else:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
33 date2 = time.asctime()
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
34 if not node1:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
35 node1 = repo.dirstate.parents()[0]
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
36 def read(f):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
37 return repo.wfile(f).read()
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
38
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
39 change = repo.changelog.read(node1)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
40 mmap = repo.manifest.read(change[0])
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
41 date1 = date(change)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
42
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
43 for f in modified:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
44 to = None
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
45 if f in mmap:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
46 to = repo.file(f).read(mmap[f])
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
47 tn = read(f)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
48 fp.write("diff --git a/%s b/%s\n" % (f, f))
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
49 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text))
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
50 for f in added:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
51 to = None
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
52 tn = read(f)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
53 fp.write("diff --git /dev/null b/%s\n" % (f))
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
54 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text))
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
55 for f in removed:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
56 to = repo.file(f).read(mmap[f])
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
57 tn = None
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
58 fp.write("diff --git a/%s /dev/null\n" % (f))
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
59 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text))
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
60
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
61 def difftree(ui, repo, node1=None, node2=None, **opts):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
62 """diff trees from two commits"""
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
63 def __difftree(repo, node1, node2):
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
64 def date(c):
1344
ca0e27e05de3 Fix hgk for date handling changes
mpm@selenic.com
parents: 1308
diff changeset
65 return time.asctime(time.gmtime(c[2][0]))
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
66
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
67 if node2:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
68 change = repo.changelog.read(node2)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
69 mmap2 = repo.manifest.read(change[0])
1619
1ba0d7041ac4 Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1618
diff changeset
70 modified, added, removed, deleted, unknown = repo.changes(node1, node2)
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
71 def read(f): return repo.file(f).read(mmap2[f])
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
72 date2 = date(change)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
73 else:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
74 date2 = time.asctime()
1619
1ba0d7041ac4 Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1618
diff changeset
75 modified, added, removed, deleted, unknown = repo.changes(node1)
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
76 if not node1:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
77 node1 = repo.dirstate.parents()[0]
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
78 def read(f): return file(os.path.join(repo.root, f)).read()
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
79
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
80 change = repo.changelog.read(node1)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
81 mmap = repo.manifest.read(change[0])
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
82 date1 = date(change)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
83 empty = "0" * 40;
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
84
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
85 for f in modified:
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
86 # TODO get file permissions
1308
2073e5a71008 Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1278
diff changeset
87 print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]),
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
88 hg.hex(mmap2[f]), f, f)
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
89 for f in added:
406
d8abb687d501 [PATCH] Using monotone-viz/git-viz with mercurial
mpm@selenic.com
parents: 396
diff changeset
90 print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f)
1618
ff339dd21976 Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1614
diff changeset
91 for f in removed:
406
d8abb687d501 [PATCH] Using monotone-viz/git-viz with mercurial
mpm@selenic.com
parents: 396
diff changeset
92 print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f)
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
93 ##
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
94
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
95 while True:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
96 if opts['stdin']:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
97 try:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
98 line = raw_input().split(' ')
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
99 node1 = line[0]
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
100 if len(line) > 1:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
101 node2 = line[1]
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
102 else:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
103 node2 = None
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
104 except EOFError:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
105 break
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
106 node1 = repo.lookup(node1)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
107 if node2:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
108 node2 = repo.lookup(node2)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
109 else:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
110 node2 = node1
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
111 node1 = repo.changelog.parents(node1)[0]
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
112 if opts['patch']:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
113 if opts['pretty']:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
114 catcommit(repo, node2, "")
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
115 dodiff(sys.stdout, ui, repo, node1, node2)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
116 else:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
117 __difftree(repo, node1, node2)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
118 if not opts['stdin']:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
119 break
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
120
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
121 def catcommit(repo, n, prefix, changes=None):
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
122 nlprefix = '\n' + prefix;
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
123 (p1, p2) = repo.changelog.parents(n)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
124 (h, h1, h2) = map(hg.hex, (n, p1, p2))
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
125 (i1, i2) = map(repo.changelog.rev, (p1, p2))
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
126 if not changes:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
127 changes = repo.changelog.read(n)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
128 print "tree %s" % (hg.hex(changes[0]))
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
129 if i1 != -1: print "parent %s" % (h1)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
130 if i2 != -1: print "parent %s" % (h2)
1344
ca0e27e05de3 Fix hgk for date handling changes
mpm@selenic.com
parents: 1308
diff changeset
131 date_ar = changes[2]
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
132 date = int(float(date_ar[0]))
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
133 lines = changes[4].splitlines()
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
134 if lines[-1].startswith('committer:'):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
135 committer = lines[-1].split(': ')[1].rstrip()
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
136 else:
1950
5f581f337b05 hgk "committer:" bug
Hollis Blanchard <hollisb@us.ibm.com>
parents: 1626
diff changeset
137 committer = changes[1]
1308
2073e5a71008 Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1278
diff changeset
138
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
139 print "author %s %s %s" % (changes[1], date, date_ar[1])
1950
5f581f337b05 hgk "committer:" bug
Hollis Blanchard <hollisb@us.ibm.com>
parents: 1626
diff changeset
140 print "committer %s %s %s" % (committer, date, date_ar[1])
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
141 print ""
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
142 if prefix != "":
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
143 print "%s%s" % (prefix, changes[4].replace('\n', nlprefix).strip())
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
144 else:
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
145 print changes[4]
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
146 if prefix:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
147 sys.stdout.write('\0')
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
148
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
149 def base(ui, repo, node1, node2):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
150 """Output common ancestor information"""
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
151 node1 = repo.lookup(node1)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
152 node2 = repo.lookup(node2)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
153 n = repo.changelog.ancestor(node1, node2)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
154 print hg.hex(n)
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
155
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
156 def catfile(ui, repo, type=None, r=None, **opts):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
157 """cat a specific revision"""
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
158 # in stdin mode, every line except the commit is prefixed with two
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
159 # spaces. This way the our caller can find the commit without magic
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
160 # strings
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
161 #
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
162 prefix = ""
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
163 if opts['stdin']:
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
164 try:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
165 (type, r) = raw_input().split(' ');
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
166 prefix = " "
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
167 except EOFError:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
168 return
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
169
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
170 else:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
171 if not type or not r:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
172 ui.warn("cat-file: type or revision not supplied\n")
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
173 commands.help_(ui, 'cat-file')
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
174
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
175 while r:
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
176 if type != "commit":
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
177 sys.stderr.write("aborting hg cat-file only understands commits\n")
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
178 sys.exit(1);
720
095dd8c757e0 Change hgit revision lookup to use repo.lookup
mason@suse.com
parents: 719
diff changeset
179 n = repo.lookup(r)
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
180 catcommit(repo, n, prefix)
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
181 if opts['stdin']:
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
182 try:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
183 (type, r) = raw_input().split(' ');
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
184 except EOFError:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
185 break
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
186 else:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
187 break
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
188
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
189 # git rev-tree is a confusing thing. You can supply a number of
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
190 # commit sha1s on the command line, and it walks the commit history
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
191 # telling you which commits are reachable from the supplied ones via
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
192 # a bitmask based on arg position.
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
193 # you can specify a commit to stop at by starting the sha1 with ^
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
194 def revtree(args, repo, full="tree", maxnr=0, parents=False):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
195 def chlogwalk():
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
196 ch = repo.changelog
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
197 count = ch.count()
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
198 i = count
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
199 l = [0] * 100
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
200 chunk = 100
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
201 while True:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
202 if chunk > i:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
203 chunk = i
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
204 i = 0
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
205 else:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
206 i -= chunk
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
207
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
208 for x in xrange(0, chunk):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
209 if i + x >= count:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
210 l[chunk - x:] = [0] * (chunk - x)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
211 break
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
212 if full != None:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
213 l[x] = ch.read(ch.node(i + x))
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
214 else:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
215 l[x] = 1
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
216 for x in xrange(chunk-1, -1, -1):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
217 if l[x] != 0:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
218 yield (i + x, full != None and l[x] or None)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
219 if i == 0:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
220 break
1308
2073e5a71008 Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1278
diff changeset
221
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
222 # calculate and return the reachability bitmask for sha
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
223 def is_reachable(ar, reachable, sha):
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
224 if len(ar) == 0:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
225 return 1
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
226 mask = 0
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
227 for i in range(len(ar)):
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
228 if sha in reachable[i]:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
229 mask |= 1 << i
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
230
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
231 return mask
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
232
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
233 reachable = []
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
234 stop_sha1 = []
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
235 want_sha1 = []
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
236 count = 0
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
237
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
238 # figure out which commits they are asking for and which ones they
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
239 # want us to stop on
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
240 for i in range(len(args)):
720
095dd8c757e0 Change hgit revision lookup to use repo.lookup
mason@suse.com
parents: 719
diff changeset
241 if args[i].startswith('^'):
095dd8c757e0 Change hgit revision lookup to use repo.lookup
mason@suse.com
parents: 719
diff changeset
242 s = repo.lookup(args[i][1:])
095dd8c757e0 Change hgit revision lookup to use repo.lookup
mason@suse.com
parents: 719
diff changeset
243 stop_sha1.append(s)
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
244 want_sha1.append(s)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
245 elif args[i] != 'HEAD':
720
095dd8c757e0 Change hgit revision lookup to use repo.lookup
mason@suse.com
parents: 719
diff changeset
246 want_sha1.append(repo.lookup(args[i]))
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
247
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
248 # calculate the graph for the supplied commits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
249 for i in range(len(want_sha1)):
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
250 reachable.append({});
720
095dd8c757e0 Change hgit revision lookup to use repo.lookup
mason@suse.com
parents: 719
diff changeset
251 n = want_sha1[i];
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
252 visit = [n];
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
253 reachable[i][n] = 1
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
254 while visit:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
255 n = visit.pop(0)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
256 if n in stop_sha1:
1243
9d10f89b75a5 Fix hgit revtree bug with stop revision handling
root@coffee.suse.com
parents: 1239
diff changeset
257 continue
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
258 for p in repo.changelog.parents(n):
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
259 if p not in reachable[i]:
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
260 reachable[i][p] = 1
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
261 visit.append(p)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
262 if p in stop_sha1:
1243
9d10f89b75a5 Fix hgit revtree bug with stop revision handling
root@coffee.suse.com
parents: 1239
diff changeset
263 continue
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
264
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
265 # walk the repository looking for commits that are in our
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
266 # reachability graph
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
267 #for i in range(repo.changelog.count()-1, -1, -1):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
268 for i, changes in chlogwalk():
334
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
269 n = repo.changelog.node(i)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
270 mask = is_reachable(want_sha1, reachable, n)
290574209284 hgit: remove tabs
mpm@selenic.com
parents: 280
diff changeset
271 if mask:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
272 parentstr = ""
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
273 if parents:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
274 pp = repo.changelog.parents(n)
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
275 if pp[0] != hg.nullid:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
276 parentstr += " " + hg.hex(pp[0])
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
277 if pp[1] != hg.nullid:
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
278 parentstr += " " + hg.hex(pp[1])
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
279 if not full:
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
280 print hg.hex(n) + parentstr
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
281 elif full is "commit":
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
282 print hg.hex(n) + parentstr
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
283 catcommit(repo, n, ' ', changes)
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
284 else:
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
285 (p1, p2) = repo.changelog.parents(n)
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
286 (h, h1, h2) = map(hg.hex, (n, p1, p2))
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
287 (i1, i2) = map(repo.changelog.rev, (p1, p2))
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
288
1344
ca0e27e05de3 Fix hgk for date handling changes
mpm@selenic.com
parents: 1308
diff changeset
289 date = changes[2][0]
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
290 print "%s %s:%s" % (date, h, mask),
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
291 mask = is_reachable(want_sha1, reachable, p1)
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
292 if i1 != -1 and mask > 0:
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
293 print "%s:%s " % (h1, mask),
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
294 mask = is_reachable(want_sha1, reachable, p2)
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
295 if i2 != -1 and mask > 0:
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
296 print "%s:%s " % (h2, mask),
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
297 print ""
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
298 if maxnr and count >= maxnr:
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
299 break
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
300 count += 1
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
301
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
302 # git rev-list tries to order things by date, and has the ability to stop
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
303 # at a given commit without walking the whole repo. TODO add the stop
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
304 # parameter
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
305 def revlist(ui, repo, *revs, **opts):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
306 """print revisions"""
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
307 if opts['header']:
356
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
308 full = "commit"
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
309 else:
7dec9a46d82a hgit rev-list support
mpm@selenic.com
parents: 350
diff changeset
310 full = None
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
311 copy = [x for x in revs]
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
312 revtree(copy, repo, full, opts['max_count'], opts['parents'])
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
313
1278
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
314 def view(ui, repo, *etc):
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
315 "start interactive history viewer"
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
316 os.chdir(repo.root)
1345
c5594ff3f95c hgk: Allow specifying hgk path in [hgk]path
mpm@selenic.com
parents: 1344
diff changeset
317 os.system(ui.config("hgk", "path", "hgk") + " " + " ".join(etc))
1278
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
318
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
319 cmdtable = {
1278
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
320 "view": (view, [], 'hg view'),
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
321 "debug-diff-tree": (difftree, [('p', 'patch', None, 'generate patch'),
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
322 ('r', 'recursive', None, 'recursive'),
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
323 ('P', 'pretty', None, 'pretty'),
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
324 ('s', 'stdin', None, 'stdin'),
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
325 ('C', 'copy', None, 'detect copies'),
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
326 ('S', 'search', "", 'search')],
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
327 "hg git-diff-tree [options] node1 node2"),
1278
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
328 "debug-cat-file": (catfile, [('s', 'stdin', None, 'stdin')],
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
329 "hg debug-cat-file [options] type file"),
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
330 "debug-merge-base": (base, [], "hg debug-merge-base node node"),
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
331 "debug-rev-list": (revlist, [('H', 'header', None, 'header'),
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
332 ('t', 'topo-order', None, 'topo-order'),
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
333 ('p', 'parents', None, 'parents'),
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
334 ('n', 'max-count', 0, 'max-count')],
1278
6a0d373d3126 hgit -> hgk.py
mpm@selenic.com
parents: 1243
diff changeset
335 "hg debug-rev-list [options] revs"),
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
336 }
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
337
1239
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
338 def reposetup(ui, repo):
29f17e083e84 Turn hgit into an extension, and add commands supporting the latest gitk
mason@suse.com
parents: 740
diff changeset
339 pass