Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extremely basic 'bup server' support.
It's enough to send a pack to the remote end with 'bup split', though 'bup save' doesn't support it yet, and we're not smart enough to do incremental backups, which means we generate the gigantic pack every single time.
- Loading branch information
Showing
8 changed files
with
150 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
bup | ||
bup-split | ||
bup-join | ||
bup-save | ||
bup-init | ||
bup-* | ||
randomgen | ||
*.o | ||
*.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python | ||
import sys, struct | ||
import options, git | ||
from helpers import * | ||
|
||
|
||
def receive_objects(f): | ||
w = git.PackWriter() | ||
while 1: | ||
ns = f.read(4) | ||
if not ns: | ||
w.abort() | ||
raise Exception('object read: expected length header, got EOF\n') | ||
n = struct.unpack('!I', ns)[0] | ||
#log('expecting %d bytes\n' % n) | ||
if not n: | ||
w.close() | ||
return | ||
buf = f.read(n) | ||
#log('read %d bytes\n' % n) | ||
if len(buf) < n: | ||
w.abort() | ||
raise Exception('object read: expected %d bytes, got %d\n' | ||
% (n, len(buf))) | ||
w._raw_write(buf) | ||
w.close() | ||
|
||
|
||
optspec = """ | ||
bup server | ||
""" | ||
o = options.Options('bup server', optspec) | ||
(opt, flags, extra) = o.parse(sys.argv[1:]) | ||
|
||
if extra: | ||
log('bup server: no arguments expected\n') | ||
o.usage() | ||
|
||
log('bup server: reading from stdin.\n') | ||
|
||
f = sys.stdin | ||
lr = linereader(f) | ||
for _line in lr: | ||
line = _line.strip() | ||
if not line: | ||
continue | ||
log('bup server: command: %r\n' % line) | ||
if line == 'quit': | ||
break | ||
elif line == 'set-dir': | ||
git.repodir = lr.next() | ||
git.check_repo_or_die() | ||
log('bup server: bupdir is %r\n' % git.repodir) | ||
elif line == 'receive-objects': | ||
git.check_repo_or_die() | ||
receive_objects(f) | ||
else: | ||
raise Exception('unknown server command: %r\n' % line) | ||
|
||
log('bup server: done\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters