Merge lp:~jelmer/brz/create-config-dir into lp:brz/3.0

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/create-config-dir
Merge into: lp:brz/3.0
Diff against target: 64 lines (+24/-2)
3 files modified
breezy/ignores.py (+2/-2)
breezy/tests/test_ignores.py (+18/-0)
doc/en/release-notes/brz-3.0.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/brz/create-config-dir
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+375362@code.launchpad.net

Commit message

Don't fail when unable to write per-user ignore list due to one of the intermediate directories not existing

Description of the change

Don't fail when unable to write per-user ignore list due to one of the intermediate directories not existing

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/ignores.py'
2--- breezy/ignores.py 2019-02-15 17:41:17 +0000
3+++ breezy/ignores.py 2019-11-18 00:41:46 +0000
4@@ -101,8 +101,8 @@
5 # since get_* should be a safe operation
6 try:
7 _set_user_ignores(USER_DEFAULTS)
8- except (IOError, OSError) as e:
9- if e.errno not in (errno.EPERM,):
10+ except EnvironmentError as e:
11+ if e.errno not in (errno.EPERM, errno.ENOENT):
12 raise
13 return patterns
14
15
16=== modified file 'breezy/tests/test_ignores.py'
17--- breezy/tests/test_ignores.py 2018-11-11 04:08:32 +0000
18+++ breezy/tests/test_ignores.py 2019-11-18 00:41:46 +0000
19@@ -16,6 +16,8 @@
20
21 """Tests for handling of ignore files"""
22
23+import os
24+
25 from .. import (
26 config,
27 ignores,
28@@ -86,6 +88,22 @@
29 entries = ignores.parse_ignore_file(f)
30 self.assertEqual(set(ignores.USER_DEFAULTS), entries)
31
32+ def test_create_with_intermediate_missing(self):
33+ # $HOME should be set to '.'
34+ ignore_path = config.user_ignore_config_filename()
35+ self.assertPathDoesNotExist(ignore_path)
36+ os.mkdir('empty-home')
37+
38+ config_path = os.path.join(self.test_dir, 'empty-home', '.config')
39+ self.overrideEnv('BRZ_HOME', config_path)
40+ self.assertPathDoesNotExist(config_path)
41+
42+ user_ignores = ignores.get_user_ignores()
43+ self.assertEqual(set(ignores.USER_DEFAULTS), user_ignores)
44+
45+ ignore_path = config.user_ignore_config_filename()
46+ self.assertPathDoesNotExist(ignore_path)
47+
48 def test_use_existing(self):
49 patterns = [u'*.o', u'*.py[co]', u'\xe5*']
50 ignores._set_user_ignores(patterns)
51
52=== modified file 'doc/en/release-notes/brz-3.0.txt'
53--- doc/en/release-notes/brz-3.0.txt 2019-11-17 23:17:29 +0000
54+++ doc/en/release-notes/brz-3.0.txt 2019-11-18 00:41:46 +0000
55@@ -36,6 +36,10 @@
56 significantly slow down startup on some platforms.
57 (Jelmer Vernooij, #1832868)
58
59+ * Don't fail when unable to write per-user ignore list due to
60+ one of the intermediate directories not existing
61+ (Jelmer Vernooij, #1851904)
62+
63 * Fix file graph operations on Git repositories.
64 (Jelmer Vernooij, #1847913)
65

Subscribers

People subscribed via source and target branches