Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7122818
D7128.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
D7128.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
@@ -354,13 +354,17 @@
self.directory[self.path] = from_disk.Content.from_file(path=self.fullpath)
+ExternalDefinition = Tuple[str, Optional[int], bool]
+
+
@dataclass
class DirState:
"""Persists some directory states (eg. externals) across revisions while
replaying them."""
- externals: Dict[str, List[Tuple[str, Optional[int]]]] = field(default_factory=dict)
- """Map a path in the directory to a list of (external_url, revision) targeting it"""
+ externals: Dict[str, List[ExternalDefinition]] = field(default_factory=dict)
+ """Map a path in the directory to a list of (external_url, revision, relative_url)
+ targeting it"""
class DirEditor:
@@ -399,7 +403,7 @@
self.dir_states = dir_states
self.svnrepo = svnrepo
self.editor = svnrepo.swhreplay.editor
- self.externals: Dict[str, List[Tuple[str, Optional[int], bool]]] = {}
+ self.externals: Dict[str, List[ExternalDefinition]] = {}
# repository root dir has empty path
if path:
@@ -634,13 +638,13 @@
relative_url: bool,
remove_target_path: bool = True,
) -> None:
- external = (external_url, revision)
+ external = (external_url, revision, relative_url)
dest_path = os.fsencode(path)
dest_fullpath = os.path.join(self.path, dest_path)
prev_externals = self.dir_states[self.path].externals
if (
path in prev_externals
- and prev_externals[path] == external
+ and external in prev_externals[path]
and dest_fullpath in self.directory
):
# external already exported, nothing to do
@@ -858,7 +862,7 @@
self.valid_externals: Dict[bytes, Tuple[str, bool]] = {}
self.dead_externals: Set[str] = set()
self.externals_cache_dir = tempfile.mkdtemp(dir=temp_dir)
- self.externals_cache: Dict[Tuple[str, Optional[int]], bytes] = {}
+ self.externals_cache: Dict[ExternalDefinition, bytes] = {}
self.svnrepo = svnrepo
self.revnum = None
# to store the set of paths added or modified when replaying a revision
diff --git a/swh/loader/svn/tests/test_loader.py b/swh/loader/svn/tests/test_loader.py
--- a/swh/loader/svn/tests/test_loader.py
+++ b/swh/loader/svn/tests/test_loader.py
@@ -2466,7 +2466,11 @@
)
check_snapshot(loader.snapshot, loader.storage)
- assert (external_url, None) in loader.svnrepo.swhreplay.editor.externals_cache
+ assert (
+ external_url,
+ None,
+ False,
+ ) in loader.svnrepo.swhreplay.editor.externals_cache
def test_loader_remove_versioned_path_with_external_overlap(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 17, 3:47 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225069
Attached To
D7128: replay: Fix external tuple use in process_external method
Event Timeline
Log In to Comment