mercurial/commands.py
changeset 353 dda243bb34b3
parent 350 b4e0e20646bb
child 354 e3667e3a18ac
equal deleted inserted replaced
352:ca39b80cbe15 353:dda243bb34b3
   169 
   169 
   170 def add(ui, repo, file, *files):
   170 def add(ui, repo, file, *files):
   171     '''add the specified files on the next commit'''
   171     '''add the specified files on the next commit'''
   172     repo.add(relpath(repo, (file,) + files))
   172     repo.add(relpath(repo, (file,) + files))
   173 
   173 
   174 def addremove(ui, repo):
   174 def addremove(ui, repo, *files):
   175     """add all new files, delete all missing files"""
   175     """add all new files, delete all missing files"""
   176     (c, a, d, u) = repo.diffdir(repo.root)
   176     if files:
       
   177         files = relpath(repo, files)
       
   178         d = []
       
   179         u = []
       
   180         for f in files:
       
   181             p = repo.wjoin(f)
       
   182             s = repo.dirstate.state(f)
       
   183             isfile = os.path.isfile(p)
       
   184             if s != 'r' and not isfile:
       
   185                 d.append(f)
       
   186             elif s not in 'nmai' and isfile:
       
   187                 u.append(f)
       
   188     else:
       
   189         (c, a, d, u) = repo.diffdir(repo.root)
   177     repo.add(u)
   190     repo.add(u)
   178     repo.remove(d)
   191     repo.remove(d)
   179 
   192 
   180 def annotate(u, repo, file, *files, **ops):
   193 def annotate(u, repo, file, *files, **ops):
   181     """show changeset information per file line"""
   194     """show changeset information per file line"""
   571 
   584 
   572 # Command options and aliases are listed here, alphabetically
   585 # Command options and aliases are listed here, alphabetically
   573 
   586 
   574 table = {
   587 table = {
   575     "add": (add, [], "hg add [files]"),
   588     "add": (add, [], "hg add [files]"),
   576     "addremove": (addremove, [], "hg addremove"),
   589     "addremove": (addremove, [], "hg addremove [files]"),
   577     "ann|annotate": (annotate,
   590     "ann|annotate": (annotate,
   578                      [('r', 'revision', '', 'revision'),
   591                      [('r', 'revision', '', 'revision'),
   579                       ('u', 'user', None, 'show user'),
   592                       ('u', 'user', None, 'show user'),
   580                       ('n', 'number', None, 'show revision number'),
   593                       ('n', 'number', None, 'show revision number'),
   581                       ('c', 'changeset', None, 'show changeset')],
   594                       ('c', 'changeset', None, 'show changeset')],