git archive origin/html | (cd Documentation; tar -xvf -)
git archive origin/man | (cd Documentation; tar -xvf -)
+# tgit.py plays with permissions on lib/bup/t/pybuptest.tmp, so we should
+# ensure that we can delete the directory before doing it.
clean: Documentation/clean
rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll *.exe \
.*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
bup bup-* cmd/bup-* lib/bup/_version.py randomgen memtest \
out[12] out2[tc] tags[12] tags2[tc] \
testfs.img lib/bup/t/testfs.img
+ chmod u+rwx lib/bup/t/pybuptest.tmp
rm -rf *.tmp t/*.tmp lib/*/*/*.tmp build lib/bup/build
if test -e testfs; then rmdir testfs; fi
if test -e lib/bup/t/testfs; then rmdir lib/bup/t/testfs; fi
initializes the default repository automatically.
"""
guess_repo(path)
- if not os.path.isdir(repo('objects/pack/.')):
- if repodir == home_repodir:
- init_repo()
+ try:
+ os.stat(repo('objects/pack/.'))
+ except OSError, e:
+ if e.errno == errno.ENOENT:
+ if repodir != home_repodir:
+ log('error: %r is not a bup/git repository\n' % repo())
+ sys.exit(15)
else:
- log('error: %r is not a bup/git repository\n' % repo())
- sys.exit(15)
+ log('error: %s\n' % e)
+ sys.exit(14)
+
+ init_repo()
_ver = None
WVPASSEQ(i.find_offset(obj3_bin), 0xff)
os.remove(name)
+
+@wvtest
+def test_check_repo_or_die():
+ git.check_repo_or_die()
+ WVPASS('check_repo_or_die') # if we reach this point the call above passed
+
+ mode = os.stat('pybuptest.tmp').st_mode
+ os.chmod('pybuptest.tmp', 0000)
+ try:
+ git.check_repo_or_die()
+ except SystemExit, e:
+ WVPASSEQ(e.code, 14)
+ else:
+ WVFAIL()
+ os.chmod('pybuptest.tmp', mode)
+
+ try:
+ git.check_repo_or_die('nonexistantbup.tmp')
+ except SystemExit, e:
+ WVPASSEQ(e.code, 15)
+ else:
+ WVFAIL()