mercurial/commands.py
changeset 809 d0fb9efa2b2d
parent 783 4b06fc1c0f26
child 810 790a0ff306f2
equal deleted inserted replaced
787:f199e1887889 809:d0fb9efa2b2d
   337     repo.add(names)
   337     repo.add(names)
   338 
   338 
   339 def addremove(ui, repo, *pats, **opts):
   339 def addremove(ui, repo, *pats, **opts):
   340     """add all new files, delete all missing files"""
   340     """add all new files, delete all missing files"""
   341     q = dict(zip(pats, pats))
   341     q = dict(zip(pats, pats))
   342     cwd = repo.getcwd()
   342     add, remove = [], []
   343     n = (cwd and len(cwd) + 1) or 0
   343     for src, abs, rel in walk(repo, pats, opts):
   344     c, a, d, u = repo.changes(match = matchpats(cwd, pats, opts))
   344         if src == 'f':
   345     for f in u:
   345             if repo.dirstate.state(abs) == '?':
   346         if f not in q:
   346                 add.append(abs)
   347             ui.status('adding %s\n' % f[n:])
   347                 if rel not in q: ui.status('adding ', rel, '\n')
   348     repo.add(u)
   348         elif repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
   349     for f in d:
   349             remove.append(abs)
   350         if f not in q:
   350             if rel not in q: ui.status('removing ', rel, '\n')
   351             ui.status('removing %s\n' % f[n:])
   351     repo.add(add)
   352     repo.remove(d)
   352     repo.remove(remove)
   353 
   353 
   354 def annotate(ui, repo, *pats, **opts):
   354 def annotate(ui, repo, *pats, **opts):
   355     """show changeset information per file line"""
   355     """show changeset information per file line"""
   356     def getnode(rev):
   356     def getnode(rev):
   357         return hg.short(repo.changelog.node(rev))
   357         return hg.short(repo.changelog.node(rev))