- if isinstance(n, vfs.BranchList): # rm /foo
- branchname = n.name
- dead_branches[branchname] = n
- dead_saves.pop(branchname, None) # rm /foo obviates rm /foo/bar
- elif isinstance(n, vfs.FakeSymlink) and isinstance(n.parent,
- vfs.BranchList):
- if n.name == 'latest':
+ leaf_name, leaf_item = resolved[-1]
+ if not leaf_item:
+ add_error('error: cannot access %s in %s'
+ % (path_msg(b'/'.join(name for name, item in resolved)),
+ path_msg(path)))
+ continue
+ if isinstance(leaf_item, vfs.RevList): # rm /foo
+ branchname = leaf_name
+ dead_branches[branchname] = leaf_item
+ dead_saves.pop(branchname, None) # rm /foo obviates rm /foo/bar
+ elif isinstance(leaf_item, vfs.Commit): # rm /foo/bar
+ if leaf_name == b'latest':