mercurial/commands.py
changeset 4576 b841dc886ba1
parent 4574 339b8aeee8c5
child 4577 b36d8cd1d8ff
equal deleted inserted replaced
4575:d092e962c4f8 4576:b841dc886ba1
   402         for f in fns:
   402         for f in fns:
   403             if f == '.':
   403             if f == '.':
   404                 continue
   404                 continue
   405             if f not in files:
   405             if f not in files:
   406                 rf = repo.wjoin(f)
   406                 rf = repo.wjoin(f)
   407                 if f in unknown:
       
   408                     raise util.Abort(_("file %s not tracked!") % rf)
       
   409                 try:
   407                 try:
   410                     mode = os.lstat(rf)[stat.ST_MODE]
   408                     mode = os.lstat(rf)[stat.ST_MODE]
   411                 except OSError:
   409                 except OSError:
   412                     raise util.Abort(_("file %s not found!") % rf)
   410                     raise util.Abort(_("file %s not found!") % rf)
   413                 if stat.S_ISDIR(mode):
   411                 if stat.S_ISDIR(mode):
   420                         raise util.Abort(_("no match under directory %s!")
   418                         raise util.Abort(_("no match under directory %s!")
   421                                          % rf)
   419                                          % rf)
   422                 elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)):
   420                 elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)):
   423                     raise util.Abort(_("can't commit %s: "
   421                     raise util.Abort(_("can't commit %s: "
   424                                        "unsupported file type!") % rf)
   422                                        "unsupported file type!") % rf)
       
   423                 elif repo.dirstate.state(f) == '?':
       
   424                     raise util.Abort(_("file %s not tracked!") % rf)
   425     else:
   425     else:
   426         files = []
   426         files = []
   427     try:
   427     try:
   428         repo.commit(files, message, opts['user'], opts['date'], match,
   428         repo.commit(files, message, opts['user'], opts['date'], match,
   429                     force_editor=opts.get('force_editor'))
   429                     force_editor=opts.get('force_editor'))