Merge lp:~dobey/bzr/xdgconfigdir into lp:~bzr/bzr/trunk-old

Proposed by Martin Pool
Status: Rejected
Rejected by: Martin Pool
Proposed branch: lp:~dobey/bzr/xdgconfigdir
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 37 lines (has conflicts)
Text conflict in bzrlib/config.py
To merge this branch: bzr merge lp:~dobey/bzr/xdgconfigdir
Reviewer Review Type Date Requested Status
Martin Pool Needs Fixing
Review via email: mp+8293@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

This is mentioned as a possible fix for https://bugs.edge.launchpad.net/bzr/+bug/195397

Revision history for this message
Martin Pool (mbp) wrote :

This is not ok to merge as it is because it silently and unconditionally renames ~/.bazaar in to ~/.config/bazaar. Users may wonder where their old files have gone and it'll break them if they try to revert to an older version of Bazaar.

As James says it's probably best for now to just search the xdg direction before searching the .bazaar directory.

review: Needs Fixing

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 2009-06-11 06:49:21 +0000
3+++ bzrlib/config.py 2009-07-07 17:35:29 +0000
4@@ -766,8 +766,13 @@
5 def config_dir():
6 """Return per-user configuration directory.
7
8+<<<<<<< TREE
9 By default this is ~/.bazaar/
10
11+=======
12+ By default this is $XDG_CONFIG_HOME/bazaar/
13+
14+>>>>>>> MERGE-SOURCE
15 TODO: Global option --config-dir to override this.
16 """
17 base = os.environ.get('BZR_HOME', None)
18@@ -783,9 +788,17 @@
19 else:
20 # cygwin, linux, and darwin all have a $HOME directory
21 if base is None:
22- base = os.path.expanduser("~")
23- return osutils.pathjoin(base, ".bazaar")
24+ base = os.environ.get('XDG_CONFIG_HOME', None)
25+ if base is None:
26+ base = osutils.pathjoin(os.path.expanduser("~"), ".config")
27+ if (!osutils.isdir(base)):
28+ os.mkdir(base)
29
30+ newpath = osutils.pathjoin(base, "bazaar")
31+ oldpath = osutils.pathjoin(os.path.expanduser("~"), ".bazaar")
32+ if (osutils.isdir(oldpath) and not osutils.isdir(newpath)):
33+ shutil.move(oldpath, newpath)
34+ return newpath
35
36 def config_filename():
37 """Return per-user configuration ini file filename."""