hgext/extdiff.py
changeset 8065 66d0a03d3afc
parent 8064 5c7bc1aece9e
child 8066 aece3c9e62f1
equal deleted inserted replaced
8064:5c7bc1aece9e 8065:66d0a03d3afc
    65         ui.note(_('making snapshot of %d files from rev %s\n') %
    65         ui.note(_('making snapshot of %d files from rev %s\n') %
    66                 (len(files), short(node)))
    66                 (len(files), short(node)))
    67     else:
    67     else:
    68         ui.note(_('making snapshot of %d files from working dir\n') %
    68         ui.note(_('making snapshot of %d files from working dir\n') %
    69             (len(files)))
    69             (len(files)))
    70         
    70     wopener = util.opener(base)
    71     fns_and_mtime = []
    71     fns_and_mtime = []
    72     ctx = repo[node]
    72     ctx = repo[node]
    73     for fn in files:
    73     for fn in files:
    74         wfn = util.pconvert(fn)
    74         wfn = util.pconvert(fn)
    75         if not wfn in ctx:
    75         if not wfn in ctx:
    76             # skipping new file after a merge ?
    76             # skipping new file after a merge ?
    77             continue
    77             continue
    78         ui.note('  %s\n' % wfn)
    78         ui.note('  %s\n' % wfn)
    79         dest = os.path.join(base, wfn)
    79         dest = os.path.join(base, wfn)
    80         destdir = os.path.dirname(dest)
    80         fctx = ctx[wfn]
    81         if not os.path.isdir(destdir):
    81         data = repo.wwritedata(wfn, fctx.data())
    82             os.makedirs(destdir)
    82         if 'l' in fctx.flags():
    83         data = repo.wwritedata(wfn, ctx[wfn].data())
    83             wopener.symlink(data, wfn)
    84         open(dest, 'wb').write(data)
    84         else:
       
    85             wopener(wfn, 'w').write(data)
       
    86             if 'x' in fctx.flags():
       
    87                 util.set_flags(dest, False, True)
    85         if node is None:
    88         if node is None:
    86             fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest)))
    89             fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest)))
    87     return dirname, fns_and_mtime
    90     return dirname, fns_and_mtime
    88 
    91 
    89 def dodiff(ui, repo, diffcmd, diffopts, pats, opts):
    92 def dodiff(ui, repo, diffcmd, diffopts, pats, opts):