Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123749
D8944.id32239.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D8944.id32239.diff
View Options
diff --git a/swh/loader/svn/replay.py b/swh/loader/svn/replay.py
--- a/swh/loader/svn/replay.py
+++ b/swh/loader/svn/replay.py
@@ -11,6 +11,7 @@
import codecs
from collections import defaultdict
+from copy import copy
from dataclasses import dataclass, field
from distutils.dir_util import copy_tree
from itertools import chain
@@ -234,7 +235,6 @@
os.makedirs(fullpath, exist_ok=True)
if copyfrom_rev == -1:
if path_bytes and path_bytes not in self.directory:
- self.dir_states[path_bytes] = DirState()
self.directory[path_bytes] = from_disk.Directory()
else:
url = svn_urljoin(self.svnrepo.remote_url, copyfrom_path)
@@ -248,6 +248,26 @@
)
self.directory[path_bytes] = from_disk.Directory.from_disk(path=fullpath)
+ assert copyfrom_path is not None
+ copyfrom_path_bytes = os.fsencode(copyfrom_path).lstrip(b"/")
+ copyfrom_fullpath = os.path.join(self.rootpath, copyfrom_path_bytes)
+
+ def _copy_dir_state(path: bytes, copied_path: bytes):
+ self.dir_states[path] = copy(self.dir_states[copied_path])
+ for external_path in self.dir_states[path].externals_paths:
+ self.editor.external_paths[os.path.join(path, external_path)] += 1
+
+ _copy_dir_state(path_bytes, copyfrom_path_bytes)
+ for root, dirs, _ in os.walk(fullpath):
+ for dir in dirs:
+ dir_fullpath = os.path.join(root, dir)
+ copied_dir_fullpath = dir_fullpath.replace(
+ fullpath, copyfrom_fullpath
+ )
+ dir_path = dir_fullpath.replace(self.rootpath, b"").lstrip(b"/")
+ copied_dir_path = copied_dir_fullpath.replace(self.rootpath, b"")
+ _copy_dir_state(dir_path, copied_dir_path.lstrip(b"/"))
+
return DirEditor(
self.directory,
self.rootpath,
diff --git a/swh/loader/svn/tests/test_externals.py b/swh/loader/svn/tests/test_externals.py
--- a/swh/loader/svn/tests/test_externals.py
+++ b/swh/loader/svn/tests/test_externals.py
@@ -1689,6 +1689,18 @@
],
)
+ add_commit(
+ repo_url,
+ "Unset svn:externals property on copied path",
+ [
+ CommitChange(
+ change_type=CommitChangeType.AddOrUpdate,
+ path="trunk/externals/",
+ properties={"svn:externals": None},
+ ),
+ ],
+ )
+
loader = SvnLoader(
swh_storage,
repo_url,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 19 2024, 11:32 PM (11 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3214888
Attached To
D8944: replay: Copy dir states and external paths in copy_from operations
Event Timeline
Log In to Comment