]> arthur.barton.de Git - bup.git/commitdiff
Switch to py2/3 compatible octal notation
authorRob Browning <rlb@defaultvalue.org>
Tue, 13 Jun 2017 05:57:49 +0000 (00:57 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 18 Jun 2017 19:49:39 +0000 (14:49 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/hashsplit.py
lib/bup/t/tgit.py
lib/bup/t/tmetadata.py
lib/bup/vfs.py

index ddf8d0c9fa8002418381bbb8802d83d4026681c3..3a4fcb840ea97695d3d283e938ce444b1b6a03c3 100644 (file)
@@ -11,10 +11,9 @@ MAX_PER_TREE = 256
 progress_callback = None
 fanout = 16
 
-GIT_MODE_FILE = 0100644
-GIT_MODE_TREE = 040000
-GIT_MODE_SYMLINK = 0120000
-assert(GIT_MODE_TREE != 40000)  # 0xxx should be treated as octal
+GIT_MODE_FILE = 0o100644
+GIT_MODE_TREE = 0o40000
+GIT_MODE_SYMLINK = 0o120000
 
 # The purpose of this type of buffer is to avoid copying on peek(), get(),
 # and eat().  We do copy the buffer contents on put(), but that should
index 2a9793e591a3dbe38d23b6b0ae5ee46a7e25333e..0293153b8bf7c211b17639304bd36ccbc59d4419 100644 (file)
@@ -28,11 +28,11 @@ def exo(*cmd):
 @wvtest
 def testmangle():
     with no_lingering_errors():
-        afile  = 0100644
-        afile2 = 0100770
-        alink  = 0120000
-        adir   = 0040000
-        adir2  = 0040777
+        afile  = 0o100644
+        afile2 = 0o100770
+        alink  = 0o120000
+        adir   = 0o040000
+        adir2  = 0o040777
         WVPASSEQ(git.mangle_name("a", adir2, adir), "a")
         WVPASSEQ(git.mangle_name(".bup", adir2, adir), ".bup.bupl")
         WVPASSEQ(git.mangle_name("a.bupa", adir2, adir), "a.bupa.bupl")
index dc8e52806101e099be9e14c547966e2112346140..f93cb0f3082b30cb57f4810cb38ef26e62d69111 100644 (file)
@@ -173,7 +173,7 @@ def test_from_path_error():
             os.mkdir(path)
             m = metadata.from_path(path, archive_path=path, save_symlinks=True)
             WVPASSEQ(m.path, path)
-            os.chmod(path, 000)
+            os.chmod(path, 0o000)
             metadata.from_path(path, archive_path=path, save_symlinks=True)
             if metadata.get_linux_file_attr:
                 print >> sys.stderr, 'saved_errors:', helpers.saved_errors
@@ -212,7 +212,7 @@ def test_apply_to_path_restricted_access():
             clear_errors()
             m = metadata.from_path(path, archive_path=path, save_symlinks=True)
             WVPASSEQ(m.path, path)
-            os.chmod(parent, 000)
+            os.chmod(parent, 0o000)
             m.apply_to_path(path)
             print >> sys.stderr, 'saved_errors:', helpers.saved_errors
             expected_errors = ['utime: ']
index 00e1b8dbe97e1d2ce9b87a8ee8937423e3ac1d62..b8ebb48d102a2be3077a899c295c021d5912477a 100644 (file)
@@ -351,7 +351,7 @@ _symrefs = 0
 class Symlink(File):
     """A symbolic link from bup's repository."""
     def __init__(self, parent, name, hash, bupmode, repo_dir=None):
-        File.__init__(self, parent, name, 0120000, hash, bupmode,
+        File.__init__(self, parent, name, 0o120000, hash, bupmode,
                       repo_dir = repo_dir)
 
     def size(self):