comparison hgext/extdiff.py @ 4088:18dcc22666a0

Make extdiff work at root directory
author Andrei Vermel <avermel@mail.ru>
date Thu, 15 Feb 2007 12:51:43 +0300
parents 67f44b825784
children 0ff50cc7acb4
comparison
equal deleted inserted replaced
4087:587c6c652f82 4088:18dcc22666a0
56 def dodiff(ui, repo, diffcmd, diffopts, pats, opts): 56 def dodiff(ui, repo, diffcmd, diffopts, pats, opts):
57 def snapshot_node(files, node): 57 def snapshot_node(files, node):
58 '''snapshot files as of some revision''' 58 '''snapshot files as of some revision'''
59 changes = repo.changelog.read(node) 59 changes = repo.changelog.read(node)
60 mf = repo.manifest.read(changes[0]) 60 mf = repo.manifest.read(changes[0])
61 dirname = '%s.%s' % (os.path.basename(repo.root), short(node)) 61 dirname = os.path.basename(repo.root)
62 if dirname == "":
63 dirname = "root"
64 dirname = '%s.%s' % (dirname, short(node))
62 base = os.path.join(tmproot, dirname) 65 base = os.path.join(tmproot, dirname)
63 os.mkdir(base) 66 os.mkdir(base)
64 if not ui.quiet: 67 if not ui.quiet:
65 ui.write_err(_('making snapshot of %d files from rev %s\n') % 68 ui.write_err(_('making snapshot of %d files from rev %s\n') %
66 (len(files), short(node))) 69 (len(files), short(node)))
80 def snapshot_wdir(files): 83 def snapshot_wdir(files):
81 '''snapshot files from working directory. 84 '''snapshot files from working directory.
82 if not using snapshot, -I/-X does not work and recursive diff 85 if not using snapshot, -I/-X does not work and recursive diff
83 in tools like kdiff3 and meld displays too many files.''' 86 in tools like kdiff3 and meld displays too many files.'''
84 dirname = os.path.basename(repo.root) 87 dirname = os.path.basename(repo.root)
88 if dirname == "":
89 dirname = "root"
85 base = os.path.join(tmproot, dirname) 90 base = os.path.join(tmproot, dirname)
86 os.mkdir(base) 91 os.mkdir(base)
87 if not ui.quiet: 92 if not ui.quiet:
88 ui.write_err(_('making snapshot of %d files from working dir\n') % 93 ui.write_err(_('making snapshot of %d files from working dir\n') %
89 (len(files))) 94 (len(files)))