]> arthur.barton.de Git - bup.git/blobdiff - cmd/save-cmd.py
Merge remote branch 'origin/master'
[bup.git] / cmd / save-cmd.py
index cf8a613bfa270d6cad3924a794198a10164cb674..4477894fefa7035ede49a45d3c451a8cbe9784ee 100755 (executable)
@@ -11,6 +11,7 @@ r,remote=  hostname:/path/to/repo of remote repository
 t,tree     output a tree id
 c,commit   output a commit id
 n,name=    name of backup set to update (if any)
+d,date=    date for the commit (seconds since the epoch)
 v,verbose  increase log output (can be used more than once)
 q,quiet    don't show progress meter
 smaller=   only back up files smaller than n bytes
@@ -30,6 +31,11 @@ opt.smaller = parse_num(opt.smaller or 0)
 if opt.bwlimit:
     client.bwlimit = parse_num(opt.bwlimit)
 
+if opt.date:
+    date = parse_date_or_fatal(opt.date, o.fatal)
+else:
+    date = time.time()
+
 is_reverse = os.environ.get('BUP_SERVER_REVERSE')
 if is_reverse and opt.remote:
     o.fatal("don't use -r in reverse mode; it's automatic")
@@ -73,7 +79,9 @@ def _pop(force_tree):
     shalist = shalists.pop()
     tree = force_tree or w.new_tree(shalist)
     if shalists:
-        shalists[-1].append(('40000', part, tree))
+        shalists[-1].append(('40000',
+                             git.mangle_name(part, 040000, 40000),
+                             tree))
     else:  # this was the toplevel, so put it back for sanity
         shalists.append(shalist)
     return tree
@@ -233,7 +241,7 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during):
                 add_error(e)
                 lastskip_name = ent.name
             else:
-                (mode, id) = hashsplit.split_to_blob_or_tree(w, [f])
+                (mode, id) = hashsplit.split_to_blob_or_tree(w, [f], False)
         else:
             if stat.S_ISDIR(ent.mode):
                 assert(0)  # handled above
@@ -276,7 +284,7 @@ if opt.tree:
 if opt.commit or opt.name:
     msg = 'bup save\n\nGenerated by command:\n%r' % sys.argv
     ref = opt.name and ('refs/heads/%s' % opt.name) or None
-    commit = w.new_commit(oldref, tree, msg)
+    commit = w.new_commit(oldref, tree, date, msg)
     if opt.commit:
         print commit.encode('hex')