##// END OF EJS Templates
copy: rewrite walkpat() to depend less on dirstate...
Martin von Zweigbergk -
r44839:2bd3b95f default
parent child Browse files
Show More
@@ -1419,32 +1419,35 b' def copy(ui, repo, pats, opts, rename=Fa'
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 wctx = repo[None]
1422 pctx = wctx.p1()
1422
1423
1423 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
1424 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
1424
1425
1425 def walkpat(pat):
1426 def walkpat(pat):
1426 srcs = []
1427 srcs = []
1427 if after:
1428 badstates = b'?'
1429 else:
1430 badstates = b'?r'
1431 m = scmutil.match(wctx, [pat], opts, globbed=True)
1428 m = scmutil.match(wctx, [pat], opts, globbed=True)
1432 for abs in wctx.walk(m):
1429 for abs in wctx.walk(m):
1433 state = repo.dirstate[abs]
1434 rel = uipathfn(abs)
1430 rel = uipathfn(abs)
1435 exact = m.exact(abs)
1431 exact = m.exact(abs)
1436 if state in badstates:
1432 if abs not in wctx:
1437 if exact and state == b'?':
1433 if abs in pctx:
1438 ui.warn(_(b'%s: not copying - file is not managed\n') % rel)
1434 if not after:
1439 if exact and state == b'r':
1435 if exact:
1440 ui.warn(
1436 ui.warn(
1441 _(
1437 _(
1442 b'%s: not copying - file has been marked for'
1438 b'%s: not copying - file has been marked '
1443 b' remove\n'
1439 b'for remove\n'
1444 )
1440 )
1445 % rel
1441 % rel
1446 )
1442 )
1447 continue
1443 continue
1444 else:
1445 if exact:
1446 ui.warn(
1447 _(b'%s: not copying - file is not managed\n') % rel
1448 )
1449 continue
1450
1448 # abs: hgsep
1451 # abs: hgsep
1449 # rel: ossep
1452 # rel: ossep
1450 srcs.append((abs, rel, exact))
1453 srcs.append((abs, rel, exact))
General Comments 0
You need to be logged in to leave comments. Login now