mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
Fixes #5255
We need a proper solution for #4832, will introduce later.
This reverts commit 8e738262ad.
This commit is contained in:
@@ -227,11 +227,6 @@ class FileMissingError(DvcException):
|
||||
)
|
||||
|
||||
|
||||
class FileOwnershipError(DvcException):
|
||||
def __init__(self, path):
|
||||
super().__init__(f"file '{path}' not owned by user! ")
|
||||
|
||||
|
||||
class DvcIgnoreInCollectedDirError(DvcException):
|
||||
def __init__(self, ignore_dirname):
|
||||
super().__init__(
|
||||
|
||||
+5
-11
@@ -8,7 +8,7 @@ import sys
|
||||
import nanotime
|
||||
from shortuuid import uuid
|
||||
|
||||
from dvc.exceptions import DvcException, FileOwnershipError
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.system import System
|
||||
from dvc.utils import dict_md5
|
||||
|
||||
@@ -95,21 +95,15 @@ def move(src, dst, mode=None):
|
||||
dst = os.path.abspath(dst)
|
||||
tmp = f"{dst}.{uuid()}"
|
||||
|
||||
try:
|
||||
if mode is not None:
|
||||
os.chmod(src, mode)
|
||||
except OSError as e:
|
||||
if e.errno not in [errno.EACCES, errno.EPERM]:
|
||||
raise
|
||||
else:
|
||||
raise FileOwnershipError(src)
|
||||
|
||||
if os.path.islink(src):
|
||||
shutil.copy(src, tmp)
|
||||
_unlink(src, _chmod)
|
||||
os.unlink(src)
|
||||
else:
|
||||
shutil.move(src, tmp)
|
||||
|
||||
if mode is not None:
|
||||
os.chmod(tmp, mode)
|
||||
|
||||
shutil.move(tmp, dst)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user