Merge lp:~parthm/bzr/doc-explicit-file-close into lp:bzr

Proposed by Parth Malwankar on 2010-05-27
Status: Merged
Approved by: Parth Malwankar on 2010-05-27
Approved revision: 5262
Merged at revision: 5263
Proposed branch: lp:~parthm/bzr/doc-explicit-file-close
Merge into: lp:bzr
Diff against target: 117 lines (+20/-12)
2 files modified
doc/developers/HACKING.txt (+9/-11)
doc/developers/code-style.txt (+11/-1)
To merge this branch: bzr merge lp:~parthm/bzr/doc-explicit-file-close
Reviewer Review Type Date Requested Status
bzr-core 2010-05-27 Pending
Review via email: mp+26121@code.launchpad.net

Commit Message

(parthm) added tip on explicit file closing to 'Portability Tips' section of code-style.txt

Description of the Change

Based on patch https://code.launchpad.net/~gz/bzr/filelifetimes/+merge/25984
added explicit file closing 'Portability Tip' to coding-style.txt
Updated a bunch of links to use bazaar.canonical.com

To post a comment you must log in.
Robert Collins (lifeless) wrote :

please land it :)

Parth Malwankar (parthm) 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 'doc/developers/HACKING.txt'
2--- doc/developers/HACKING.txt 2010-05-16 09:29:44 +0000
3+++ doc/developers/HACKING.txt 2010-05-27 05:01:28 +0000
4@@ -12,8 +12,7 @@
5 document, send a merge request or new text to the mailing list.
6
7 The latest developer documentation can be found online at
8-http://doc.bazaar-vcs.org/developers/.
9-
10+http://doc.bazaar.canonical.com/developers/.
11
12 Getting Started
13 ###############
14@@ -29,7 +28,7 @@
15 To answer these questions and more, take a moment to explore the
16 overall Bazaar Platform. Here are some links to browse:
17
18-* The Plugins page on the Wiki - http://bazaar-vcs.org/BzrPlugins
19+* The Plugins page on the Wiki - http://wiki.bazaar.canonical.com/BzrPlugins
20
21 * The Bazaar product family on Launchpad - https://launchpad.net/bazaar
22
23@@ -53,7 +52,7 @@
24
25 There is a very active community around Bazaar. Mostly we meet on IRC
26 (#bzr on irc.freenode.net) and on the mailing list. To join the Bazaar
27-community, see http://bazaar-vcs.org/BzrSupport.
28+community, see http://wiki.bazaar.canonical.com/BzrSupport.
29
30 If you are planning to make a change, it's a very good idea to mention it
31 on the IRC channel and/or on the mailing list. There are many advantages
32@@ -202,7 +201,7 @@
33
34 * Launchpad - https://launchpad.net/
35
36-* Bazaar - http://bazaar-vcs.org/
37+* Bazaar - http://bazaar.canonical.com/
38
39 * Patch Queue Manager - https://launchpad.net/pqm/
40
41@@ -215,7 +214,7 @@
42 ================================================
43
44 Bazaar supports many ways of organising your work. See
45-http://bazaar-vcs.org/SharedRepositoryLayouts for a summary of the
46+http://wiki.bazaar.canonical.com/SharedRepositoryLayouts for a summary of the
47 popular alternatives.
48
49 Of course, the best choice for you will depend on numerous factors:
50@@ -292,7 +291,7 @@
51 <http://starship.python.net/crew/mwh/bzrlibapi/>.
52
53 See also the `Bazaar Architectural Overview
54-<http://doc.bazaar-vcs.org/developers/overview.html>`_.
55+<http://doc.bazaar.canonical.com/developers/overview.html>`_.
56
57
58 Core Topics
59@@ -824,8 +823,7 @@
60 Making Installers for OS Windows
61 ================================
62 To build a win32 installer, see the instructions on the wiki page:
63-http://bazaar-vcs.org/BzrWin32Installer
64-
65+http://wiki.bazaar.canonical.com/BzrWin32Installer
66
67 Core Developer Tasks
68 ####################
69@@ -844,7 +842,7 @@
70 * reviewing changes
71 * reviewing blueprints
72 * planning releases
73-* managing releases (see `Releasing Bazaar <http://doc.bazaar-vcs.org/developers/releasing.html>`_)
74+* managing releases (see `Releasing Bazaar <http://doc.bazaar.canonical.com/developers/releasing.html>`_)
75
76 .. note::
77 Removing barriers to community participation is a key reason for adopting
78@@ -896,7 +894,7 @@
79 Of the many workflows supported by Bazaar, the one adopted for Bazaar
80 development itself is known as "Decentralized with automatic gatekeeper".
81 To repeat the explanation of this given on
82-http://bazaar-vcs.org/Workflows:
83+http://wiki.bazaar.canonical.com/Workflows:
84
85 .. pull-quote::
86 In this workflow, each developer has their own branch or
87
88=== modified file 'doc/developers/code-style.txt'
89--- doc/developers/code-style.txt 2010-05-27 02:06:11 +0000
90+++ doc/developers/code-style.txt 2010-05-27 05:01:28 +0000
91@@ -341,7 +341,7 @@
92 =============
93
94 All code should be exercised by the test suite. See the `Bazaar Testing
95-Guide <http://doc.bazaar-vcs.org/developers/testing.html>`_ for detailed
96+Guide <http://doc.bazaar.canonical.com/developers/testing.html>`_ for detailed
97 information about writing tests.
98
99
100@@ -411,7 +411,17 @@
101 to fail on Windows if some files are readonly or still open elsewhere.
102 Use ``bzrlib.osutils.rmtree`` instead.
103
104+Using the ``open(..).read(..)`` or ``open(..).write(..)`` style chaining
105+of methods for reading or writing file content relies on garbage collection
106+to close the file which may keep the file open for an undefined period of
107+time. This may break some follow up operations like rename on Windows.
108+Use ``try/finally`` to explictly close the file. E.g.::
109
110+ f = open('foo.txt', 'w')
111+ try:
112+ f.write(s)
113+ finally:
114+ f.close()
115
116 ..
117 vim: ft=rst tw=74 ai