Merge lp:~gz/bzr-git/import_os_not_posix_841177 into lp:bzr-git

Proposed by Martin Packman
Status: Merged
Merged at revision: 1357
Proposed branch: lp:~gz/bzr-git/import_os_not_posix_841177
Merge into: lp:bzr-git
Diff against target: 53 lines (+18/-0) (has conflicts)
1 file modified
workingtree.py (+18/-0)
Text conflict in workingtree.py
To merge this branch: bzr merge lp:~gz/bzr-git/import_os_not_posix_841177
Reviewer Review Type Date Requested Status
bzr-git developers Pending
Review via email: mp+74023@code.launchpad.net

Description of the change

Makes bzr-git stick to the `os` module, which is a platform independent wrapper for the builtin `posix`, `nt` and so on modules. There is no behaviour change here, apart from making the module importable on non-posix systems.

I resisted changing `posixpath` usage into `os.path` because it's not trivial to tell which is actually desired. Paths from the filesystem should be operated on with `os.path` but normalized bzrlib paths that use forward slashes only can use most of the posixpath functions safely.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

To answer a query from IRC, stat_result doesn't have different content or behaviour in the cases here. See statresult_new in Modules/posixmodules.c which is pretty straight forward. (The module source confusingly has 'posix' in the name but is cross-platform code, and results in a module named after the platform).

The conflicts with trunk are a little crazy, but should be easy enough to resolve correctly now.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'workingtree.py'
2--- workingtree.py 2011-09-04 18:33:18 +0000
3+++ workingtree.py 2011-09-04 18:42:40 +0000
4@@ -34,7 +34,11 @@
5 ZERO_SHA,
6 )
7 import os
8+<<<<<<< TREE
9 from posix import stat_result
10+=======
11+# GZ 2011-09-04: Should use os.path instead unless certain of posix format.
12+>>>>>>> MERGE-SOURCE
13 import posixpath
14 import stat
15 import sys
16@@ -131,7 +135,12 @@
17 except (errors.NoSuchFile, IOError):
18 # TODO: Rather than come up with something here, use the old index
19 file = StringIO()
20+<<<<<<< TREE
21 stat_val = stat_result((stat.S_IFREG | 0644, 0, 0, 0, 0, 0, 0, 0, 0, 0))
22+=======
23+ stat_val = os.stat_result(
24+ (stat.S_IFREG | 0644, 0, 0, 0, 0, 0, 0, 0, 0, 0))
25+>>>>>>> MERGE-SOURCE
26 blob.set_raw_string(file.read())
27 elif kind == "symlink":
28 blob = Blob()
29@@ -140,7 +149,12 @@
30 except (errors.NoSuchFile, OSError):
31 # TODO: Rather than come up with something here, use the
32 # old index
33+<<<<<<< TREE
34 stat_val = stat_result((stat.S_IFLNK, 0, 0, 0, 0, 0, 0, 0, 0, 0))
35+=======
36+ stat_val = os.stat_result(
37+ (stat.S_IFLNK, 0, 0, 0, 0, 0, 0, 0, 0, 0))
38+>>>>>>> MERGE-SOURCE
39 blob.set_raw_string(
40 self.get_symlink_target(file_id, path).encode("utf-8"))
41 else:
42@@ -695,7 +709,11 @@
43 dir_file_id = self.path2id(dirname)
44 assert isinstance(value, tuple) and len(value) == 10
45 (ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags) = value
46+<<<<<<< TREE
47 stat_result = stat_result((mode, ino,
48+=======
49+ stat_result = os.stat_result((mode, ino,
50+>>>>>>> MERGE-SOURCE
51 dev, 1, uid, gid, size,
52 0, mtime, ctime))
53 per_dir[(dirname, dir_file_id)].append(

Subscribers

People subscribed via source and target branches

to all changes: