Merge lp:~lifeless/python-oops-datedir-repo/0.0.8 into lp:python-oops-datedir-repo

Proposed by Robert Collins
Status: Merged
Merged at revision: 17
Proposed branch: lp:~lifeless/python-oops-datedir-repo/0.0.8
Merge into: lp:python-oops-datedir-repo
Diff against target: 88 lines (+23/-3)
6 files modified
NEWS (+9/-0)
oops_datedir_repo/__init__.py (+1/-1)
oops_datedir_repo/repository.py (+2/-1)
oops_datedir_repo/tests/test_repository.py (+9/-0)
setup.py (+1/-1)
versions.cfg (+1/-0)
To merge this branch: bzr merge lp:~lifeless/python-oops-datedir-repo/0.0.8
Reviewer Review Type Date Requested Status
Ian Booth (community) code Approve
Review via email: mp+78543@code.launchpad.net

Description of the change

I made a booboo in 0.0.7 which ec2 found for me in LP. This fixes it an obvious way (isdir is easier than catching an OSError exception and checking its the exact error that might happen).

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Looks good.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2011-10-04 05:09:28 +0000
3+++ NEWS 2011-10-07 06:07:26 +0000
4@@ -6,6 +6,15 @@
5 NEXT
6 ----
7
8+0.0.8
9+-----
10+
11+* Set a specific version for the oops dependency - fixes bootstrapping.
12+ (Robert Collins)
13+
14+* Fix broken code in 0.0.7's hash naming support - only create the target date
15+ directory once. (Robert Collins)
16+
17 0.0.7
18 -----
19
20
21=== modified file 'oops_datedir_repo/__init__.py'
22--- oops_datedir_repo/__init__.py 2011-10-04 04:13:53 +0000
23+++ oops_datedir_repo/__init__.py 2011-10-07 06:07:26 +0000
24@@ -25,7 +25,7 @@
25 # established at this point, and setup.py will use a version of next-$(revno).
26 # If the releaselevel is 'final', then the tarball will be major.minor.micro.
27 # Otherwise it is major.minor.micro~$(revno).
28-__version__ = (0, 0, 7, 'beta', 0)
29+__version__ = (0, 0, 8, 'beta', 0)
30
31 __all__ = [
32 'DateDirRepo',
33
34=== modified file 'oops_datedir_repo/repository.py'
35--- oops_datedir_repo/repository.py 2011-10-04 05:08:20 +0000
36+++ oops_datedir_repo/repository.py 2011-10-07 06:07:26 +0000
37@@ -85,7 +85,8 @@
38 md5hash = md5(serializer_bson.dumps(report)).hexdigest()
39 oopsid = 'OOPS-%s' % md5hash
40 prefix = os.path.join(self.root, now.strftime('%Y-%m-%d'))
41- os.makedirs(prefix)
42+ if not os.path.isdir(prefix):
43+ os.makedirs(prefix)
44 filename = os.path.join(prefix, oopsid)
45 report['id'] = oopsid
46 self.serializer.write(report, open(filename, 'wb'))
47
48=== modified file 'oops_datedir_repo/tests/test_repository.py'
49--- oops_datedir_repo/tests/test_repository.py 2011-10-04 05:08:20 +0000
50+++ oops_datedir_repo/tests/test_repository.py 2011-10-07 06:07:26 +0000
51@@ -96,3 +96,12 @@
52 self.assertEqual(
53 {'id': expected_id, 'time': now},
54 bson.loads(fp.read()))
55+
56+ def test_multiple_hash_publications(self):
57+ # The initial datedir hash code could only publish one oops a day.
58+ repo = DateDirRepo(self.useFixture(TempDir()).path)
59+ now = datetime.datetime(2006, 04, 01, 00, 30, 00, tzinfo=utc)
60+ report = {'time': now}
61+ repo.publish(report, now)
62+ report2 = {'time': now, 'foo': 'bar'}
63+ repo.publish(report2, now)
64
65=== modified file 'setup.py'
66--- setup.py 2011-10-04 04:13:53 +0000
67+++ setup.py 2011-10-07 06:07:26 +0000
68@@ -22,7 +22,7 @@
69 description = file(os.path.join(os.path.dirname(__file__), 'README'), 'rb').read()
70
71 setup(name="oops_datedir_repo",
72- version="0.0.7",
73+ version="0.0.8",
74 description="OOPS disk serialisation and repository management.",
75 long_description=description,
76 maintainer="Launchpad Developers",
77
78=== modified file 'versions.cfg'
79--- versions.cfg 2011-10-04 04:13:53 +0000
80+++ versions.cfg 2011-10-07 06:07:26 +0000
81@@ -5,6 +5,7 @@
82 bson = 0.3.2
83 fixtures = 0.3.6
84 iso8601 = 0.1.4
85+oops = 0.0.8
86 pytz = 2010o
87 setuptools = 0.6c11
88 testtools = 0.9.11

Subscribers

People subscribed via source and target branches

to all changes: