##// END OF EJS Templates
Unify display of dates....
Bryan O'Sullivan -
r1318:3f4f7601 default
parent child Browse files
Show More
@@ -30,6 +30,20 b' def relpath(repo, args):'
30 return [util.normpath(os.path.join(cwd, x)) for x in args]
30 return [util.normpath(os.path.join(cwd, x)) for x in args]
31 return args
31 return args
32
32
33 def datestr(change=None):
34 if change is None:
35 t = time.time()
36 if time.daylight: tz = time.altzone
37 else: tz = time.timezone
38 else:
39 t, tz = change[2].split(' ')
40 try:
41 # a conversion tool was sticking non-integer offsets into repos
42 tz = int(tz)
43 except ValueError:
44 tz = 0
45 return time.asctime(time.gmtime(float(t) - tz)) + " %+05d" % (int(tz)/-36)
46
33 def matchpats(repo, cwd, pats=[], opts={}, head=''):
47 def matchpats(repo, cwd, pats=[], opts={}, head=''):
34 return util.matcher(repo.root, cwd, pats or ['.'], opts.get('include'),
48 return util.matcher(repo.root, cwd, pats or ['.'], opts.get('include'),
35 opts.get('exclude'), head)
49 opts.get('exclude'), head)
@@ -251,9 +265,6 b' def make_file(repo, r, pat, node=None,'
251
265
252 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
266 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
253 changes=None, text=False):
267 changes=None, text=False):
254 def date(c):
255 return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
256
257 if not changes:
268 if not changes:
258 (c, a, d, u) = repo.changes(node1, node2, files, match=match)
269 (c, a, d, u) = repo.changes(node1, node2, files, match=match)
259 else:
270 else:
@@ -267,11 +278,11 b' def dodiff(fp, ui, repo, node1, node2, f'
267 if node2:
278 if node2:
268 change = repo.changelog.read(node2)
279 change = repo.changelog.read(node2)
269 mmap2 = repo.manifest.read(change[0])
280 mmap2 = repo.manifest.read(change[0])
270 date2 = date(change)
281 date2 = datestr(change)
271 def read(f):
282 def read(f):
272 return repo.file(f).read(mmap2[f])
283 return repo.file(f).read(mmap2[f])
273 else:
284 else:
274 date2 = time.asctime()
285 date2 = datestr()
275 if not node1:
286 if not node1:
276 node1 = repo.dirstate.parents()[0]
287 node1 = repo.dirstate.parents()[0]
277 def read(f):
288 def read(f):
@@ -285,7 +296,7 b' def dodiff(fp, ui, repo, node1, node2, f'
285
296
286 change = repo.changelog.read(node1)
297 change = repo.changelog.read(node1)
287 mmap = repo.manifest.read(change[0])
298 mmap = repo.manifest.read(change[0])
288 date1 = date(change)
299 date1 = datestr(change)
289
300
290 for f in c:
301 for f in c:
291 to = None
302 to = None
@@ -322,14 +333,7 b' def show_changeset(ui, repo, rev=0, chan'
322 return
333 return
323
334
324 changes = log.read(changenode)
335 changes = log.read(changenode)
325
336 date = datestr(changes)
326 t, tz = changes[2].split(' ')
327 # a conversion tool was sticking non-integer offsets into repos
328 try:
329 tz = int(tz)
330 except ValueError:
331 tz = 0
332 date = time.asctime(time.gmtime(float(t) - tz)) + " %+05d" % (int(tz)/-36)
333
337
334 parents = [(log.rev(p), ui.verbose and hex(p) or short(p))
338 parents = [(log.rev(p), ui.verbose and hex(p) or short(p))
335 for p in log.parents(changenode)
339 for p in log.parents(changenode)
General Comments 0
You need to be logged in to leave comments. Login now