hgext/extdiff.py
changeset 4089 0ff50cc7acb4
parent 4088 18dcc22666a0
child 4096 49237d6ae97d
equal deleted inserted replaced
4088:18dcc22666a0 4089:0ff50cc7acb4
    75             ui.note('  %s\n' % wfn)
    75             ui.note('  %s\n' % wfn)
    76             dest = os.path.join(base, wfn)
    76             dest = os.path.join(base, wfn)
    77             destdir = os.path.dirname(dest)
    77             destdir = os.path.dirname(dest)
    78             if not os.path.isdir(destdir):
    78             if not os.path.isdir(destdir):
    79                 os.makedirs(destdir)
    79                 os.makedirs(destdir)
    80             repo.wwrite(wfn, repo.file(fn).read(mf[fn]), open(dest, 'w'))
    80             repo.wwrite(wfn, repo.file(fn).read(mf[fn]), open(dest, 'wb'))
    81         return dirname
    81         return dirname
    82 
    82 
    83     def snapshot_wdir(files):
    83     def snapshot_wdir(files):
    84         '''snapshot files from working directory.
    84         '''snapshot files from working directory.
    85         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
    97             ui.note('  %s\n' % wfn)
    97             ui.note('  %s\n' % wfn)
    98             dest = os.path.join(base, wfn)
    98             dest = os.path.join(base, wfn)
    99             destdir = os.path.dirname(dest)
    99             destdir = os.path.dirname(dest)
   100             if not os.path.isdir(destdir):
   100             if not os.path.isdir(destdir):
   101                 os.makedirs(destdir)
   101                 os.makedirs(destdir)
   102             fp = open(dest, 'w')
   102             fp = open(dest, 'wb')
   103             for chunk in util.filechunkiter(repo.wopener(wfn)):
   103             for chunk in util.filechunkiter(repo.wopener(wfn)):
   104                 fp.write(chunk)
   104                 fp.write(chunk)
   105         return dirname
   105         return dirname
   106 
   106 
   107     node1, node2 = cmdutil.revpair(repo, opts['rev'])
   107     node1, node2 = cmdutil.revpair(repo, opts['rev'])