]> arthur.barton.de Git - bup.git/blobdiff - cmd/restore-cmd.py
rev_list: handle multiple results/ref from remote for custom formats
[bup.git] / cmd / restore-cmd.py
index bb37811b447518a7a1edb09b36fc32d28c4bca8a..0edbdefff1395dff0ca101efdb8f3728bae306c7 100755 (executable)
@@ -246,10 +246,21 @@ def main():
             add_error("path %r doesn't include a branch and revision" % path)
             continue
         try:
-            resolved = vfs.lresolve(repo, path, want_meta=True)
+            resolved = vfs.resolve(repo, path, want_meta=True, follow=False)
         except vfs.IOError as e:
             add_error(e)
             continue
+        if len(resolved) == 3 and resolved[2][0] == 'latest':
+            # Follow latest symlink to the actual save
+            try:
+                resolved = vfs.resolve(repo, 'latest', parent=resolved[:-1],
+                                       want_meta=True)
+            except vfs.IOError as e:
+                add_error(e)
+                continue
+            # Rename it back to 'latest'
+            resolved = tuple(elt if i != 2 else ('latest',) + elt[1:]
+                             for i, elt in enumerate(resolved))
         path_parent, path_name = os.path.split(path)
         leaf_name, leaf_item = resolved[-1]
         if not leaf_item: