##// END OF EJS Templates
largefiles: use the core file copy logic to validate the destination path...
Matt Harbison -
r24006:42fa7eeb default
parent child Browse files
Show More
@@ -559,16 +559,6 b' def overridecopy(orig, ui, repo, pats, o'
559 # this isn't legal, let the original function deal with it
559 # this isn't legal, let the original function deal with it
560 return orig(ui, repo, pats, opts, rename)
560 return orig(ui, repo, pats, opts, rename)
561
561
562 def makestandin(relpath):
563 path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
564 return os.path.join(repo.wjoin(lfutil.standin(path)))
565
566 fullpats = scmutil.expandpats(pats)
567 dest = fullpats[-1]
568
569 if os.path.isdir(dest):
570 if not os.path.isdir(makestandin(dest)):
571 os.makedirs(makestandin(dest))
572 # This could copy both lfiles and normal files in one command,
562 # This could copy both lfiles and normal files in one command,
573 # but we don't want to do that. First replace their matcher to
563 # but we don't want to do that. First replace their matcher to
574 # only match normal files and run it, then replace it to just
564 # only match normal files and run it, then replace it to just
@@ -595,6 +585,17 b' def overridecopy(orig, ui, repo, pats, o'
595 except OSError:
585 except OSError:
596 return result
586 return result
597
587
588 def makestandin(relpath):
589 path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
590 return os.path.join(repo.wjoin(lfutil.standin(path)))
591
592 fullpats = scmutil.expandpats(pats)
593 dest = fullpats[-1]
594
595 if os.path.isdir(dest):
596 if not os.path.isdir(makestandin(dest)):
597 os.makedirs(makestandin(dest))
598
598 try:
599 try:
599 try:
600 try:
600 # When we call orig below it creates the standins but we don't add
601 # When we call orig below it creates the standins but we don't add
@@ -620,10 +620,16 b' check illegal path components'
620 $ hg rename d1/d11/a1 .hg
620 $ hg rename d1/d11/a1 .hg
621 abort: path contains illegal component: .hg/a1 (glob)
621 abort: path contains illegal component: .hg/a1 (glob)
622 [255]
622 [255]
623 $ hg --config extensions.largefiles= rename d1/d11/a1 .hg
624 abort: path contains illegal component: .hg/a1 (glob)
625 [255]
623 $ hg status -C
626 $ hg status -C
624 $ hg rename d1/d11/a1 ..
627 $ hg rename d1/d11/a1 ..
625 abort: ../a1 not under root '$TESTTMP' (glob)
628 abort: ../a1 not under root '$TESTTMP' (glob)
626 [255]
629 [255]
630 $ hg --config extensions.largefiles= rename d1/d11/a1 ..
631 abort: ../a1 not under root '$TESTTMP' (glob)
632 [255]
627 $ hg status -C
633 $ hg status -C
628
634
629 $ mv d1/d11/a1 .hg
635 $ mv d1/d11/a1 .hg
General Comments 0
You need to be logged in to leave comments. Login now