MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / create_add_file

Function create_add_file

tests/test_diff.py:101–143  ·  view source on GitHub ↗
(pth: Path, fixtures)

Source from the content-addressed store, hash-verified

99
100
101def create_add_file(pth: Path, fixtures):
102 filename = "wheel-0.34.2.tar.gz"
103 file_pth = fixtures.path(f"mirror/{filename}")
104
105 assert os.path.exists(file_pth)
106
107 struct = []
108
109 # Add a new file to the same directory
110 dest1 = pth / "add_file/empty_directory"
111 dest1.mkdir(parents=True)
112 dest2 = pth / "add_file/directory1" / filename
113 dest2.parent.mkdir(parents=True)
114 os.symlink(src=file_pth, dst=dest2)
115 struct.append((
116 ScanLocation(dest1),
117 ScanLocation(dest2.parent),
118 {
119 "operation": "A",
120 "a_ref": None,
121 "b_ref": filename,
122 "a_size": 0,
123 "b_size": 58330
124 }
125 ))
126
127 # Add a new file into subdirectory
128 dest2 = pth / "add_file/directory2/subdirectory" / filename
129 dest2.parent.mkdir(parents=True)
130 os.symlink(src=file_pth, dst=dest2)
131 struct.append((
132 ScanLocation(dest1),
133 ScanLocation(dest2.parent.parent),
134 {
135 "operation": "A",
136 "a_ref": None,
137 "b_ref": f"subdirectory/{filename}",
138 "a_size": 0,
139 "b_size": 58330
140 }
141 ))
142
143 return struct
144
145
146def create_del_file(pth: Path, fixtures):

Callers

nothing calls this directly

Calls 3

ScanLocationClass · 0.90
pathMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected