Merge lp:~fme/bzr/bzr into lp:bzr

Proposed by Fabien Meghazi (OpenERP) on 2014-05-07
Status: Merged
Approved by: Richard Wilbur on 2014-05-07
Approved revision: 6592
Merged at revision: 6596
Proposed branch: lp:~fme/bzr/bzr
Merge into: lp:bzr
Diff against target: 95 lines (+20/-19)
4 files modified
bzrlib/config.py (+9/-11)
bzrlib/tests/test_config.py (+1/-1)
doc/developers/xdg_config_spec.txt (+4/-7)
doc/en/release-notes/bzr-2.7.txt (+6/-0)
To merge this branch: bzr merge lp:~fme/bzr/bzr
Reviewer Review Type Date Requested Status
Richard Wilbur 2014-05-07 Approve on 2014-05-07
Review via email: mp+218683@code.launchpad.net

This proposal supersedes a proposal from 2014-02-14.

Commit message

Also honor $XDG_CONFIG_HOME specification on Mac OS X platform. (Fabien Meghazi)

Description of the change

Also honor $XDG_CONFIG_HOME specification on Mac OS X platform.

There's no reason to prevent OS X platform to use the XDG_CONFIG_HOME spec.

To post a comment you must log in.
Richard Wilbur (richard-wilbur) wrote :

Good catch Fabien!
+2

review: Approve
Richard Wilbur (richard-wilbur) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/config.py'
2--- bzrlib/config.py 2014-01-23 19:00:51 +0000
3+++ bzrlib/config.py 2014-05-07 19:06:00 +0000
4@@ -1488,7 +1488,7 @@
5 """Return per-user configuration directory as unicode string
6
7 By default this is %APPDATA%/bazaar/2.0 on Windows, ~/.bazaar on Mac OS X
8- and Linux. On Linux, if there is a $XDG_CONFIG_HOME/bazaar directory,
9+ and Linux. On Mac OS X and Linux, if there is a $XDG_CONFIG_HOME/bazaar directory,
10 that will be used instead.
11
12 TODO: Global option --config-dir to override this.
13@@ -1503,16 +1503,14 @@
14 # APPDATA, but hard to move. See bug 348640 for more.
15 return osutils.pathjoin(base, 'bazaar', '2.0')
16 if base is None:
17- # GZ 2012-02-01: What should OSX use instead of XDG if anything?
18- if sys.platform != 'darwin':
19- xdg_dir = osutils.path_from_environ('XDG_CONFIG_HOME')
20- if xdg_dir is None:
21- xdg_dir = osutils.pathjoin(osutils._get_home_dir(), ".config")
22- xdg_dir = osutils.pathjoin(xdg_dir, 'bazaar')
23- if osutils.isdir(xdg_dir):
24- trace.mutter(
25- "Using configuration in XDG directory %s." % xdg_dir)
26- return xdg_dir
27+ xdg_dir = osutils.path_from_environ('XDG_CONFIG_HOME')
28+ if xdg_dir is None:
29+ xdg_dir = osutils.pathjoin(osutils._get_home_dir(), ".config")
30+ xdg_dir = osutils.pathjoin(xdg_dir, 'bazaar')
31+ if osutils.isdir(xdg_dir):
32+ trace.mutter(
33+ "Using configuration in XDG directory %s." % xdg_dir)
34+ return xdg_dir
35 base = osutils._get_home_dir()
36 return osutils.pathjoin(base, ".bazaar")
37
38
39=== modified file 'bzrlib/tests/test_config.py'
40--- bzrlib/tests/test_config.py 2014-01-23 19:00:51 +0000
41+++ bzrlib/tests/test_config.py 2014-05-07 19:06:00 +0000
42@@ -595,7 +595,7 @@
43 # subdirectory of $XDG_CONFIG_HOME
44
45 def setUp(self):
46- if sys.platform in ('darwin', 'win32'):
47+ if sys.platform == 'win32':
48 raise tests.TestNotApplicable(
49 'XDG config dir not used on this platform')
50 super(TestXDGConfigDir, self).setUp()
51
52=== modified file 'doc/developers/xdg_config_spec.txt'
53--- doc/developers/xdg_config_spec.txt 2010-11-27 05:38:41 +0000
54+++ doc/developers/xdg_config_spec.txt 2014-05-07 19:06:00 +0000
55@@ -2,9 +2,8 @@
56 ===================================================================
57
58 Currently, Bazaar stores its configuration files and plugins under the
59-directory ~/.bazaar on unix installs. On Windows, this is
60-%APPDATA%/Bazaar/2.0 and on Mac OS X, the directory is ~/.bazaar. With the
61-XDG Base Directory specification
62+directory ~/.bazaar on unix installs. On Windows, this is %APPDATA%/Bazaar/2.0.
63+With the XDG Base Directory specification
64 (http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html), many
65 Linux and Unix platforms have tried to centralize configuration files under a
66 specific directory referred to as $XDG_CONFIG_HOME. This has a default value
67@@ -13,10 +12,8 @@
68 Bazaar would like to be a good Unix citizen by using these standard locations
69 for configuration files. As such, we should support that location, but not
70 require it. Note that the following descriptions do not apply
71-to Windows or Mac OS X which should use their own native configuration
72-locations. (On Windows, we currently do this by working under %APPDATA%. The
73-Mac OS X equivalent would be ~/Library/Application Support/Bazaar but there is
74-also cultural support for ~/.bazaar on that platform.)
75+to Windows which should use their own native configuration
76+locations. (On Windows, we currently do this by working under %APPDATA%.
77
78 * If $XDG_CONFIG_HOME/bazaar exists, use the files there for configuration,
79 noting in the log that we are doing so. This allows individuals who would
80
81=== modified file 'doc/en/release-notes/bzr-2.7.txt'
82--- doc/en/release-notes/bzr-2.7.txt 2014-04-16 07:18:26 +0000
83+++ doc/en/release-notes/bzr-2.7.txt 2014-05-07 19:06:00 +0000
84@@ -59,6 +59,12 @@
85 .. Major internal changes, unlikely to be visible to users or plugin
86 developers, but interesting for bzr developers.
87
88+Changed Behaviour
89+*****************
90+
91+* Also honor $XDG_CONFIG_HOME specification on Mac OS X platform.
92+ (Fabien Meghazi)
93+
94 Testing
95 *******
96