MCPcopy
hub / github.com/borgbackup/borg / do_debug_get_obj

Method do_debug_get_obj

src/borg/archiver/debug_cmd.py:201–214  ·  view source on GitHub ↗

Gets object contents from the repository and writes them to a file.

(self, args, repository)

Source from the content-addressed store, hash-verified

199
200 @with_repository(manifest=False)
201 def do_debug_get_obj(self, args, repository):
202 """Gets object contents from the repository and writes them to a file."""
203 hex_id = args.id
204 try:
205 id = hex_to_bin(hex_id, length=32)
206 except ValueError as err:
207 raise CommandError(f"object id {hex_id} is invalid [{str(err)}].")
208 try:
209 data = repository.get(id)
210 except Repository.ObjectNotFound:
211 raise RTError("object %s not found." % hex_id)
212 with open(args.path, "wb") as f:
213 f.write(data)
214 print("object %s fetched." % hex_id)
215
216 @with_repository(compatibility=Manifest.NO_OPERATION_CHECK)
217 def do_debug_id_hash(self, args, repository, manifest):

Callers

nothing calls this directly

Calls 5

hex_to_binFunction · 0.85
CommandErrorClass · 0.85
RTErrorClass · 0.85
getMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected