comparison hgext/extdiff.py @ 7570:e05aa73ce2b7

use repo.wjoin(f) instead of os.path.join(repo.root, f)
author Martin Geisler <mg@daimi.au.dk>
date Fri, 02 Jan 2009 22:53:33 +0100
parents bd979854a388
children 7bf7c073375e
comparison
equal deleted inserted replaced
7559:016a7319e76b 7570:e05aa73ce2b7
78 78
79 def snapshot_wdir(ui, repo, files, tmproot): 79 def snapshot_wdir(ui, repo, files, tmproot):
80 '''snapshot files from working directory. 80 '''snapshot files from working directory.
81 if not using snapshot, -I/-X does not work and recursive diff 81 if not using snapshot, -I/-X does not work and recursive diff
82 in tools like kdiff3 and meld displays too many files.''' 82 in tools like kdiff3 and meld displays too many files.'''
83 repo_root = repo.root 83 dirname = os.path.basename(repo.root)
84
85 dirname = os.path.basename(repo_root)
86 if dirname == "": 84 if dirname == "":
87 dirname = "root" 85 dirname = "root"
88 base = os.path.join(tmproot, dirname) 86 base = os.path.join(tmproot, dirname)
89 os.mkdir(base) 87 os.mkdir(base)
90 ui.note(_('making snapshot of %d files from working dir\n') % 88 ui.note(_('making snapshot of %d files from working dir\n') %
103 fp = open(dest, 'wb') 101 fp = open(dest, 'wb')
104 for chunk in util.filechunkiter(repo.wopener(wfn)): 102 for chunk in util.filechunkiter(repo.wopener(wfn)):
105 fp.write(chunk) 103 fp.write(chunk)
106 fp.close() 104 fp.close()
107 105
108 fns_and_mtime.append((dest, os.path.join(repo_root, fn), 106 fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest)))
109 os.path.getmtime(dest)))
110 107
111 108
112 return dirname, fns_and_mtime 109 return dirname, fns_and_mtime
113 110
114 111