mercurial/cmdutil.py
changeset 44361 27a78ea30b48
parent 44360 2bd3b95fdce0
child 44364 8be0c63535b5
equal deleted inserted replaced
44360:2bd3b95fdce0 44361:27a78ea30b48
  1416     # ossep => pathname that uses os.sep to separate directories
  1416     # ossep => pathname that uses os.sep to separate directories
  1417     cwd = repo.getcwd()
  1417     cwd = repo.getcwd()
  1418     targets = {}
  1418     targets = {}
  1419     after = opts.get(b"after")
  1419     after = opts.get(b"after")
  1420     dryrun = opts.get(b"dry_run")
  1420     dryrun = opts.get(b"dry_run")
  1421     wctx = repo[None]
  1421     ctx = repo[None]
  1422     pctx = wctx.p1()
  1422     pctx = ctx.p1()
  1423 
  1423 
  1424     uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
  1424     uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
  1425 
  1425 
  1426     def walkpat(pat):
  1426     def walkpat(pat):
  1427         srcs = []
  1427         srcs = []
  1428         m = scmutil.match(wctx, [pat], opts, globbed=True)
  1428         m = scmutil.match(ctx, [pat], opts, globbed=True)
  1429         for abs in wctx.walk(m):
  1429         for abs in ctx.walk(m):
  1430             rel = uipathfn(abs)
  1430             rel = uipathfn(abs)
  1431             exact = m.exact(abs)
  1431             exact = m.exact(abs)
  1432             if abs not in wctx:
  1432             if abs not in ctx:
  1433                 if abs in pctx:
  1433                 if abs in pctx:
  1434                     if not after:
  1434                     if not after:
  1435                         if exact:
  1435                         if exact:
  1436                             ui.warn(
  1436                             ui.warn(
  1437                                 _(
  1437                                 _(
  1580 
  1580 
  1581         targets[abstarget] = abssrc
  1581         targets[abstarget] = abssrc
  1582 
  1582 
  1583         # fix up dirstate
  1583         # fix up dirstate
  1584         scmutil.dirstatecopy(
  1584         scmutil.dirstatecopy(
  1585             ui, repo, wctx, abssrc, abstarget, dryrun=dryrun, cwd=cwd
  1585             ui, repo, ctx, abssrc, abstarget, dryrun=dryrun, cwd=cwd
  1586         )
  1586         )
  1587         if rename and not dryrun:
  1587         if rename and not dryrun:
  1588             if not after and srcexists and not samefile:
  1588             if not after and srcexists and not samefile:
  1589                 rmdir = repo.ui.configbool(b'experimental', b'removeemptydirs')
  1589                 rmdir = repo.ui.configbool(b'experimental', b'removeemptydirs')
  1590                 repo.wvfs.unlinkpath(abssrc, rmdir=rmdir)
  1590                 repo.wvfs.unlinkpath(abssrc, rmdir=rmdir)
  1591             wctx.forget([abssrc])
  1591             ctx.forget([abssrc])
  1592 
  1592 
  1593     # pat: ossep
  1593     # pat: ossep
  1594     # dest ossep
  1594     # dest ossep
  1595     # srcs: list of (hgsep, hgsep, ossep, bool)
  1595     # srcs: list of (hgsep, hgsep, ossep, bool)
  1596     # return: function that takes hgsep and returns ossep
  1596     # return: function that takes hgsep and returns ossep