Gets object contents from the repository and writes them to a file.
(self, args, repository)
| 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): |
nothing calls this directly
no test coverage detected