[PATCH] atomictempfile: rewrite docstring to clarify rename() vs. close()

Greg Ward greg-hg at gerg.ca
Sun Apr 24 18:28:23 CDT 2011


# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1303680650 14400
# Node ID 81010c598d28d10cb8946e5877b7a9f5a51adb1e
# Parent  8f9478be9a94641ae76604d41fc83b339a2051eb
atomictempfile: rewrite docstring to clarify rename() vs. close().

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -719,12 +719,15 @@
     return temp
 
 class atomictempfile(object):
-    """file-like object that atomically updates a file
+    '''writeable file object that atomically updates a file
 
-    All writes will be redirected to a temporary copy of the original
-    file.  When rename is called, the copy is renamed to the original
-    name, making the changes visible.
-    """
+    All writes will go to a temporary copy of the original file. Call
+    rename() when you are done writing, and atomictempfile will rename
+    the temporary copy to the original name, making the changes visible.
+
+    Unlike other file-like objects, close() discards your writes by
+    simply deleting the temporary file.
+    '''
     def __init__(self, name, mode='w+b', createmode=None):
         self.__name = name
         self._fp = None


More information about the Mercurial-devel mailing list