Rev 6069: (gz) Provide st_uid and st_gid on _Win32Stat so it looks more like a normal in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.4/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Mar 29 10:43:49 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.4/

------------------------------------------------------------
revno: 6069 [merge]
revision-id: pqm at pqm.ubuntu.com-20120329104349-70dq6u8qbionntav
parent: pqm at pqm.ubuntu.com-20120327232036-bnbqjsu6nx2qd4js
parent: bialix at ukr.net-20120329083500-gg5pi8xjykx88ykb
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Thu 2012-03-29 10:43:49 +0000
message:
  (gz) Provide st_uid and st_gid on _Win32Stat so it looks more like a normal
   stat object (Alexander Belchenko)
modified:
  bzrlib/_walkdirs_win32.pyx     _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2
  bzrlib/tests/test__walkdirs_win32.py test__walkdirs_win32-20080716220454-kweh3tgxez5dvw2l-3
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/_walkdirs_win32.pyx'
--- a/bzrlib/_walkdirs_win32.pyx	2011-04-05 12:15:34 +0000
+++ b/bzrlib/_walkdirs_win32.pyx	2012-03-29 08:34:13 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2011 Canonical Ltd
+# Copyright (C) 2008-2012 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -95,8 +95,19 @@
             return self._st_size
 
     # os.stat always returns 0, so we hard code it here
-    cdef readonly int st_dev
-    cdef readonly int st_ino
+    property st_dev:
+        def __get__(self):
+            return 0
+    property st_ino:
+        def __get__(self):
+            return 0
+    # st_uid and st_gid required for some external tools like bzr-git & dulwich
+    property st_uid:
+        def __get__(self):
+            return 0
+    property st_gid:
+        def __get__(self):
+            return 0
 
     def __repr__(self):
         """Repr is the same as a Stat object.
@@ -195,8 +206,6 @@
         statvalue.st_mtime = _ftime_to_timestamp(&data.ftLastWriteTime)
         statvalue.st_atime = _ftime_to_timestamp(&data.ftLastAccessTime)
         statvalue._st_size = _get_size(data)
-        statvalue.st_ino = 0
-        statvalue.st_dev = 0
         return statvalue
 
     def read_dir(self, prefix, top):
@@ -288,6 +297,4 @@
     statvalue.st_mtime = st.st_mtime
     statvalue.st_atime = st.st_atime
     statvalue._st_size = st.st_size
-    statvalue.st_ino = 0
-    statvalue.st_dev = 0
     return statvalue

=== modified file 'bzrlib/tests/test__walkdirs_win32.py'
--- a/bzrlib/tests/test__walkdirs_win32.py	2010-05-16 12:21:31 +0000
+++ b/bzrlib/tests/test__walkdirs_win32.py	2012-03-29 08:35:00 +0000
@@ -93,3 +93,22 @@
         self.assertEqual(errno.ENOENT, e.errno)
         self.assertEqual(3, e.winerror)
         self.assertEqual((3, u'no_such_dir/*'), e.args)
+
+
+class Test_Win32Stat(tests.TestCaseInTempDir):
+
+    _test_needs_features = [win32_readdir_feature]
+
+    def setUp(self):
+        super(Test_Win32Stat, self).setUp()
+        from bzrlib._walkdirs_win32 import lstat
+        self.win32_lstat = lstat
+
+    def test_zero_members_present(self):
+        self.build_tree(['foo'])
+        st = self.win32_lstat('foo')
+        # we only want to ensure that some members are present
+        self.assertEqual(0, st.st_dev)
+        self.assertEqual(0, st.st_ino)
+        self.assertEqual(0, st.st_uid)
+        self.assertEqual(0, st.st_gid)

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2012-02-26 19:56:15 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2012-03-28 14:04:31 +0000
@@ -55,6 +55,10 @@
 * Prevent a traceback being printed to stderr when logging has problems and
   accept utf-8 byte string without breaking. (Martin Packman, #714449)
 
+* _Win32Stat object provides members st_uid and st_gid, those are present
+  in Python's os.stat object. These members required for external tools like
+  bzr-git and dulwich. (Alexander Belchenko, #967060)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list