hgext/extdiff.py
changeset 4088 18dcc22666a0
parent 3707 67f44b825784
child 4089 0ff50cc7acb4
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)))