mercurial/commands.py
changeset 4232 0d51eb296fb9
parent 4218 5ccbc0be6cdb
parent 4231 83153299aab5
child 4250 ca639faa38a2
equal deleted inserted replaced
4224:2a8b6d78d7ee 4232:0d51eb296fb9
   491     # abssrc: hgsep
   491     # abssrc: hgsep
   492     # relsrc: ossep
   492     # relsrc: ossep
   493     # target: ossep
   493     # target: ossep
   494     def copy(origsrc, abssrc, relsrc, target, exact):
   494     def copy(origsrc, abssrc, relsrc, target, exact):
   495         abstarget = util.canonpath(repo.root, cwd, target)
   495         abstarget = util.canonpath(repo.root, cwd, target)
   496         reltarget = util.pathto(cwd, abstarget)
   496         reltarget = util.pathto(repo.root, cwd, abstarget)
   497         prevsrc = targets.get(abstarget)
   497         prevsrc = targets.get(abstarget)
   498         if prevsrc is not None:
   498         if prevsrc is not None:
   499             ui.warn(_('%s: not overwriting - %s collides with %s\n') %
   499             ui.warn(_('%s: not overwriting - %s collides with %s\n') %
   500                     (reltarget, util.localpath(abssrc),
   500                     (reltarget, util.localpath(abssrc),
   501                      util.localpath(prevsrc)))
   501                      util.localpath(prevsrc)))
  2170         if src == 'b':
  2170         if src == 'b':
  2171             target_only[abs] = True
  2171             target_only[abs] = True
  2172 
  2172 
  2173     # walk target manifest.
  2173     # walk target manifest.
  2174 
  2174 
       
  2175     def badmatch(path):
       
  2176         if path in names:
       
  2177             return True
       
  2178         path_ = path + '/'
       
  2179         for f in names:
       
  2180             if f.startswith(path_):
       
  2181                 return True
       
  2182         return False
       
  2183 
  2175     for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node,
  2184     for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node,
  2176                                              badmatch=names.has_key):
  2185                                              badmatch=badmatch):
  2177         if abs in names: continue
  2186         if abs in names or src == 'b':
       
  2187             continue
  2178         names[abs] = (rel, exact)
  2188         names[abs] = (rel, exact)
  2179         target_only[abs] = True
  2189         target_only[abs] = True
  2180 
  2190 
  2181     changes = repo.status(match=names.has_key, wlock=wlock)[:5]
  2191     changes = repo.status(match=names.has_key, wlock=wlock)[:5]
  2182     modified, added, removed, deleted, unknown = map(dict.fromkeys, changes)
  2192     modified, added, removed, deleted, unknown = map(dict.fromkeys, changes)
  2412             format = "%%s%s" % end
  2422             format = "%%s%s" % end
  2413         else:
  2423         else:
  2414             format = "%s %%s%s" % (char, end)
  2424             format = "%s %%s%s" % (char, end)
  2415 
  2425 
  2416         for f in changes:
  2426         for f in changes:
  2417             ui.write(format % util.pathto(cwd, f))
  2427             ui.write(format % util.pathto(repo.root, cwd, f))
  2418             if ((all or opts.get('copies')) and not opts.get('no_status')):
  2428             if ((all or opts.get('copies')) and not opts.get('no_status')):
  2419                 copied = repo.dirstate.copied(f)
  2429                 copied = repo.dirstate.copied(f)
  2420                 if copied:
  2430                 if copied:
  2421                     ui.write('  %s%s' % (util.pathto(cwd, copied), end))
  2431                     ui.write('  %s%s' % (util.pathto(repo.root, cwd, copied),
       
  2432                                          end))
  2422 
  2433 
  2423 def tag(ui, repo, name, rev_=None, **opts):
  2434 def tag(ui, repo, name, rev_=None, **opts):
  2424     """add a tag for the current or given revision
  2435     """add a tag for the current or given revision
  2425 
  2436 
  2426     Name a particular revision using <name>.
  2437     Name a particular revision using <name>.