|
@@
-45,7
+45,7
b''
|
|
45
|
# Revisions context menu will now display additional entries to fire
|
|
45
|
# Revisions context menu will now display additional entries to fire
|
|
46
|
# vdiff on hovered and selected revisions.
|
|
46
|
# vdiff on hovered and selected revisions.
|
|
47
|
|
|
47
|
|
|
48
|
import sys, os
|
|
48
|
import os
|
|
49
|
from mercurial import hg, fancyopts, commands, ui, util, patch, revlog
|
|
49
|
from mercurial import hg, fancyopts, commands, ui, util, patch, revlog
|
|
50
|
|
|
50
|
|
|
51
|
def difftree(ui, repo, node1=None, node2=None, *files, **opts):
|
|
51
|
def difftree(ui, repo, node1=None, node2=None, *files, **opts):
|
|
@@
-61,17
+61,14
b' def difftree(ui, repo, node1=None, node2'
|
|
61
|
|
|
61
|
|
|
62
|
for f in modified:
|
|
62
|
for f in modified:
|
|
63
|
# TODO get file permissions
|
|
63
|
# TODO get file permissions
|
|
64
|
print ":100664 100664 %s %s M\t%s\t%s" % (hg.short(mmap[f]),
|
|
64
|
ui.write(":100664 100664 %s %s M\t%s\t%s\n" %
|
|
65
|
hg.short(mmap2[f]),
|
|
65
|
(hg.short(mmap[f]), hg.short(mmap2[f]), f, f))
|
|
66
|
f, f)
|
|
|
|
|
67
|
for f in added:
|
|
66
|
for f in added:
|
|
68
|
print ":000000 100664 %s %s N\t%s\t%s" % (empty,
|
|
67
|
ui.write(":000000 100664 %s %s N\t%s\t%s\n" %
|
|
69
|
hg.short(mmap2[f]),
|
|
68
|
(empty, hg.short(mmap2[f]), f, f))
|
|
70
|
f, f)
|
|
|
|
|
71
|
for f in removed:
|
|
69
|
for f in removed:
|
|
72
|
print ":100664 000000 %s %s D\t%s\t%s" % (hg.short(mmap[f]),
|
|
70
|
ui.write(":100664 000000 %s %s D\t%s\t%s\n" %
|
|
73
|
empty,
|
|
71
|
(hg.short(mmap[f]), empty, f, f))
|
|
74
|
f, f)
|
|
|
|
|
75
|
##
|
|
72
|
##
|
|
76
|
|
|
73
|
|
|
77
|
while True:
|
|
74
|
while True:
|
|
@@
-93,7
+90,7
b' def difftree(ui, repo, node1=None, node2'
|
|
93
|
node1 = repo.changelog.parents(node1)[0]
|
|
90
|
node1 = repo.changelog.parents(node1)[0]
|
|
94
|
if opts['patch']:
|
|
91
|
if opts['patch']:
|
|
95
|
if opts['pretty']:
|
|
92
|
if opts['pretty']:
|
|
96
|
catcommit(repo, node2, "")
|
|
93
|
catcommit(ui, repo, node2, "")
|
|
97
|
patch.diff(repo, node1, node2,
|
|
94
|
patch.diff(repo, node1, node2,
|
|
98
|
files=files,
|
|
95
|
files=files,
|
|
99
|
opts=patch.diffopts(ui, {'git': True}))
|
|
96
|
opts=patch.diffopts(ui, {'git': True}))
|
|
@@
-102,14
+99,14
b' def difftree(ui, repo, node1=None, node2'
|
|
102
|
if not opts['stdin']:
|
|
99
|
if not opts['stdin']:
|
|
103
|
break
|
|
100
|
break
|
|
104
|
|
|
101
|
|
|
105
|
def catcommit(repo, n, prefix, ctx=None):
|
|
102
|
def catcommit(ui, repo, n, prefix, ctx=None):
|
|
106
|
nlprefix = '\n' + prefix;
|
|
103
|
nlprefix = '\n' + prefix;
|
|
107
|
if ctx is None:
|
|
104
|
if ctx is None:
|
|
108
|
ctx = repo.changectx(n)
|
|
105
|
ctx = repo.changectx(n)
|
|
109
|
(p1, p2) = ctx.parents()
|
|
106
|
(p1, p2) = ctx.parents()
|
|
110
|
print "tree %s" % (hg.short(ctx.changeset()[0])) # use ctx.node() instead ??
|
|
107
|
ui.write("tree %s\n" % hg.short(ctx.changeset()[0])) # use ctx.node() instead ??
|
|
111
|
if p1: print "parent %s" % (hg.short(p1.node()))
|
|
108
|
if p1: ui.write("parent %s\n" % hg.short(p1.node()))
|
|
112
|
if p2: print "parent %s" % (hg.short(p2.node()))
|
|
109
|
if p2: ui.write("parent %s\n" % hg.short(p2.node()))
|
|
113
|
date = ctx.date()
|
|
110
|
date = ctx.date()
|
|
114
|
description = ctx.description().replace("\0", "")
|
|
111
|
description = ctx.description().replace("\0", "")
|
|
115
|
lines = description.splitlines()
|
|
112
|
lines = description.splitlines()
|
|
@@
-118,24
+115,24
b' def catcommit(repo, n, prefix, ctx=None)'
|
|
118
|
else:
|
|
115
|
else:
|
|
119
|
committer = ctx.user()
|
|
116
|
committer = ctx.user()
|
|
120
|
|
|
117
|
|
|
121
|
print "author %s %s %s" % (ctx.user(), int(date[0]), date[1])
|
|
118
|
ui.write("author %s %s %s\n" % (ctx.user(), int(date[0]), date[1]))
|
|
122
|
print "committer %s %s %s" % (committer, int(date[0]), date[1])
|
|
119
|
ui.write("committer %s %s %s\n" % (committer, int(date[0]), date[1]))
|
|
123
|
print "revision %d" % ctx.rev()
|
|
120
|
ui.write("revision %d\n" % ctx.rev())
|
|
124
|
print "branch %s" % ctx.branch()
|
|
121
|
ui.write("branch %s\n\n" % ctx.branch())
|
|
125
|
print ""
|
|
122
|
|
|
126
|
if prefix != "":
|
|
123
|
if prefix != "":
|
|
127
|
print "%s%s" % (prefix, description.replace('\n', nlprefix).strip())
|
|
124
|
ui.write("%s%s\n" % (prefix, description.replace('\n', nlprefix).strip()))
|
|
128
|
else:
|
|
125
|
else:
|
|
129
|
print description
|
|
126
|
ui.write(description + "\n")
|
|
130
|
if prefix:
|
|
127
|
if prefix:
|
|
131
|
sys.stdout.write('\0')
|
|
128
|
ui.write('\0')
|
|
132
|
|
|
129
|
|
|
133
|
def base(ui, repo, node1, node2):
|
|
130
|
def base(ui, repo, node1, node2):
|
|
134
|
"""Output common ancestor information"""
|
|
131
|
"""Output common ancestor information"""
|
|
135
|
node1 = repo.lookup(node1)
|
|
132
|
node1 = repo.lookup(node1)
|
|
136
|
node2 = repo.lookup(node2)
|
|
133
|
node2 = repo.lookup(node2)
|
|
137
|
n = repo.changelog.ancestor(node1, node2)
|
|
134
|
n = repo.changelog.ancestor(node1, node2)
|
|
138
|
print hg.short(n)
|
|
135
|
ui.write(hg.short(n) + "\n")
|
|
139
|
|
|
136
|
|
|
140
|
def catfile(ui, repo, type=None, r=None, **opts):
|
|
137
|
def catfile(ui, repo, type=None, r=None, **opts):
|
|
141
|
"""cat a specific revision"""
|
|
138
|
"""cat a specific revision"""
|
|
@@
-158,10
+155,10
b' def catfile(ui, repo, type=None, r=None,'
|
|
158
|
|
|
155
|
|
|
159
|
while r:
|
|
156
|
while r:
|
|
160
|
if type != "commit":
|
|
157
|
if type != "commit":
|
|
161
|
sys.stderr.write("aborting hg cat-file only understands commits\n")
|
|
158
|
ui.warn("aborting hg cat-file only understands commits\n")
|
|
162
|
sys.exit(1);
|
|
159
|
return 1;
|
|
163
|
n = repo.lookup(r)
|
|
160
|
n = repo.lookup(r)
|
|
164
|
catcommit(repo, n, prefix)
|
|
161
|
catcommit(ui, repo, n, prefix)
|
|
165
|
if opts['stdin']:
|
|
162
|
if opts['stdin']:
|
|
166
|
try:
|
|
163
|
try:
|
|
167
|
(type, r) = raw_input().split(' ');
|
|
164
|
(type, r) = raw_input().split(' ');
|
|
@@
-175,7
+172,7
b' def catfile(ui, repo, type=None, r=None,'
|
|
175
|
# telling you which commits are reachable from the supplied ones via
|
|
172
|
# telling you which commits are reachable from the supplied ones via
|
|
176
|
# a bitmask based on arg position.
|
|
173
|
# a bitmask based on arg position.
|
|
177
|
# you can specify a commit to stop at by starting the sha1 with ^
|
|
174
|
# you can specify a commit to stop at by starting the sha1 with ^
|
|
178
|
def revtree(args, repo, full="tree", maxnr=0, parents=False):
|
|
175
|
def revtree(ui, args, repo, full="tree", maxnr=0, parents=False):
|
|
179
|
def chlogwalk():
|
|
176
|
def chlogwalk():
|
|
180
|
count = repo.changelog.count()
|
|
177
|
count = repo.changelog.count()
|
|
181
|
i = count
|
|
178
|
i = count
|
|
@@
-260,24
+257,24
b' def revtree(args, repo, full="tree", max'
|
|
260
|
if pp[1] != hg.nullid:
|
|
257
|
if pp[1] != hg.nullid:
|
|
261
|
parentstr += " " + hg.short(pp[1])
|
|
258
|
parentstr += " " + hg.short(pp[1])
|
|
262
|
if not full:
|
|
259
|
if not full:
|
|
263
|
print hg.short(n) + parentstr
|
|
260
|
ui.write("%s%s\n" % (hg.short(n), parentstr))
|
|
264
|
elif full == "commit":
|
|
261
|
elif full == "commit":
|
|
265
|
print hg.short(n) + parentstr
|
|
262
|
ui.write("%s%s\n" % (hg.short(n), parentstr))
|
|
266
|
catcommit(repo, n, ' ', ctx)
|
|
263
|
catcommit(ui, repo, n, ' ', ctx)
|
|
267
|
else:
|
|
264
|
else:
|
|
268
|
(p1, p2) = repo.changelog.parents(n)
|
|
265
|
(p1, p2) = repo.changelog.parents(n)
|
|
269
|
(h, h1, h2) = map(hg.short, (n, p1, p2))
|
|
266
|
(h, h1, h2) = map(hg.short, (n, p1, p2))
|
|
270
|
(i1, i2) = map(repo.changelog.rev, (p1, p2))
|
|
267
|
(i1, i2) = map(repo.changelog.rev, (p1, p2))
|
|
271
|
|
|
268
|
|
|
272
|
date = ctx.date()[0]
|
|
269
|
date = ctx.date()[0]
|
|
273
|
print "%s %s:%s" % (date, h, mask),
|
|
270
|
ui.write("%s %s:%s" % (date, h, mask))
|
|
274
|
mask = is_reachable(want_sha1, reachable, p1)
|
|
271
|
mask = is_reachable(want_sha1, reachable, p1)
|
|
275
|
if i1 != hg.nullrev and mask > 0:
|
|
272
|
if i1 != hg.nullrev and mask > 0:
|
|
276
|
print "%s:%s " % (h1, mask),
|
|
273
|
ui.write("%s:%s " % (h1, mask)),
|
|
277
|
mask = is_reachable(want_sha1, reachable, p2)
|
|
274
|
mask = is_reachable(want_sha1, reachable, p2)
|
|
278
|
if i2 != hg.nullrev and mask > 0:
|
|
275
|
if i2 != hg.nullrev and mask > 0:
|
|
279
|
print "%s:%s " % (h2, mask),
|
|
276
|
ui.write("%s:%s " % (h2, mask))
|
|
280
|
print ""
|
|
277
|
ui.write("\n")
|
|
281
|
if maxnr and count >= maxnr:
|
|
278
|
if maxnr and count >= maxnr:
|
|
282
|
break
|
|
279
|
break
|
|
283
|
count += 1
|
|
280
|
count += 1
|
|
@@
-305,7
+302,7
b' def revlist(ui, repo, *revs, **opts):'
|
|
305
|
else:
|
|
302
|
else:
|
|
306
|
full = None
|
|
303
|
full = None
|
|
307
|
copy = [x for x in revs]
|
|
304
|
copy = [x for x in revs]
|
|
308
|
revtree(copy, repo, full, opts['max_count'], opts['parents'])
|
|
305
|
revtree(ui, copy, repo, full, opts['max_count'], opts['parents'])
|
|
309
|
|
|
306
|
|
|
310
|
def config(ui, repo, **opts):
|
|
307
|
def config(ui, repo, **opts):
|
|
311
|
"""print extension options"""
|
|
308
|
"""print extension options"""
|