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

Proposed by Fabien Meghazi (OpenERP)
Status: Merged
Approved by: Richard Wilbur
Approved revision: no longer in the source branch.
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 Approve
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.
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Good catch Fabien!
+2

review: Approve
Revision history for this message
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
=== modified file 'bzrlib/config.py'
--- bzrlib/config.py 2014-01-23 19:00:51 +0000
+++ bzrlib/config.py 2014-05-07 19:06:00 +0000
@@ -1488,7 +1488,7 @@
1488 """Return per-user configuration directory as unicode string1488 """Return per-user configuration directory as unicode string
14891489
1490 By default this is %APPDATA%/bazaar/2.0 on Windows, ~/.bazaar on Mac OS X1490 By default this is %APPDATA%/bazaar/2.0 on Windows, ~/.bazaar on Mac OS X
1491 and Linux. On Linux, if there is a $XDG_CONFIG_HOME/bazaar directory,1491 and Linux. On Mac OS X and Linux, if there is a $XDG_CONFIG_HOME/bazaar directory,
1492 that will be used instead.1492 that will be used instead.
14931493
1494 TODO: Global option --config-dir to override this.1494 TODO: Global option --config-dir to override this.
@@ -1503,16 +1503,14 @@
1503 # APPDATA, but hard to move. See bug 348640 for more.1503 # APPDATA, but hard to move. See bug 348640 for more.
1504 return osutils.pathjoin(base, 'bazaar', '2.0')1504 return osutils.pathjoin(base, 'bazaar', '2.0')
1505 if base is None:1505 if base is None:
1506 # GZ 2012-02-01: What should OSX use instead of XDG if anything?1506 xdg_dir = osutils.path_from_environ('XDG_CONFIG_HOME')
1507 if sys.platform != 'darwin':1507 if xdg_dir is None:
1508 xdg_dir = osutils.path_from_environ('XDG_CONFIG_HOME')1508 xdg_dir = osutils.pathjoin(osutils._get_home_dir(), ".config")
1509 if xdg_dir is None:1509 xdg_dir = osutils.pathjoin(xdg_dir, 'bazaar')
1510 xdg_dir = osutils.pathjoin(osutils._get_home_dir(), ".config")1510 if osutils.isdir(xdg_dir):
1511 xdg_dir = osutils.pathjoin(xdg_dir, 'bazaar')1511 trace.mutter(
1512 if osutils.isdir(xdg_dir):1512 "Using configuration in XDG directory %s." % xdg_dir)
1513 trace.mutter(1513 return xdg_dir
1514 "Using configuration in XDG directory %s." % xdg_dir)
1515 return xdg_dir
1516 base = osutils._get_home_dir()1514 base = osutils._get_home_dir()
1517 return osutils.pathjoin(base, ".bazaar")1515 return osutils.pathjoin(base, ".bazaar")
15181516
15191517
=== modified file 'bzrlib/tests/test_config.py'
--- bzrlib/tests/test_config.py 2014-01-23 19:00:51 +0000
+++ bzrlib/tests/test_config.py 2014-05-07 19:06:00 +0000
@@ -595,7 +595,7 @@
595 # subdirectory of $XDG_CONFIG_HOME595 # subdirectory of $XDG_CONFIG_HOME
596596
597 def setUp(self):597 def setUp(self):
598 if sys.platform in ('darwin', 'win32'):598 if sys.platform == 'win32':
599 raise tests.TestNotApplicable(599 raise tests.TestNotApplicable(
600 'XDG config dir not used on this platform')600 'XDG config dir not used on this platform')
601 super(TestXDGConfigDir, self).setUp()601 super(TestXDGConfigDir, self).setUp()
602602
=== modified file 'doc/developers/xdg_config_spec.txt'
--- doc/developers/xdg_config_spec.txt 2010-11-27 05:38:41 +0000
+++ doc/developers/xdg_config_spec.txt 2014-05-07 19:06:00 +0000
@@ -2,9 +2,8 @@
2===================================================================2===================================================================
33
4Currently, Bazaar stores its configuration files and plugins under the4Currently, Bazaar stores its configuration files and plugins under the
5directory ~/.bazaar on unix installs. On Windows, this is5directory ~/.bazaar on unix installs. On Windows, this is %APPDATA%/Bazaar/2.0.
6%APPDATA%/Bazaar/2.0 and on Mac OS X, the directory is ~/.bazaar. With the6With the XDG Base Directory specification
7XDG Base Directory specification
8(http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html), many7(http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html), many
9Linux and Unix platforms have tried to centralize configuration files under a8Linux and Unix platforms have tried to centralize configuration files under a
10specific directory referred to as $XDG_CONFIG_HOME. This has a default value9specific directory referred to as $XDG_CONFIG_HOME. This has a default value
@@ -13,10 +12,8 @@
13Bazaar would like to be a good Unix citizen by using these standard locations12Bazaar would like to be a good Unix citizen by using these standard locations
14for configuration files. As such, we should support that location, but not13for configuration files. As such, we should support that location, but not
15require it. Note that the following descriptions do not apply14require it. Note that the following descriptions do not apply
16to Windows or Mac OS X which should use their own native configuration15to Windows which should use their own native configuration
17locations. (On Windows, we currently do this by working under %APPDATA%. The16locations. (On Windows, we currently do this by working under %APPDATA%.
18Mac OS X equivalent would be ~/Library/Application Support/Bazaar but there is
19also cultural support for ~/.bazaar on that platform.)
2017
21* If $XDG_CONFIG_HOME/bazaar exists, use the files there for configuration,18* If $XDG_CONFIG_HOME/bazaar exists, use the files there for configuration,
22 noting in the log that we are doing so. This allows individuals who would19 noting in the log that we are doing so. This allows individuals who would
2320
=== modified file 'doc/en/release-notes/bzr-2.7.txt'
--- doc/en/release-notes/bzr-2.7.txt 2014-04-16 07:18:26 +0000
+++ doc/en/release-notes/bzr-2.7.txt 2014-05-07 19:06:00 +0000
@@ -59,6 +59,12 @@
59.. Major internal changes, unlikely to be visible to users or plugin 59.. Major internal changes, unlikely to be visible to users or plugin
60 developers, but interesting for bzr developers.60 developers, but interesting for bzr developers.
6161
62Changed Behaviour
63*****************
64
65* Also honor $XDG_CONFIG_HOME specification on Mac OS X platform.
66 (Fabien Meghazi)
67
62Testing68Testing
63*******69*******
6470