changeset 4:ce3bd728b858

Fix exception handling for reading current working version
author mpm@selenic.com
date Tue, 03 May 2005 18:36:16 -0800
parents 3a6392190075
children 5f249577ac40
files mercurial/hg.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Tue May 03 18:35:26 2005 -0800
+++ b/mercurial/hg.py	Tue May 03 18:36:16 2005 -0800
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import sys, struct, sha, socket, os, time, base64, re, urllib2
+import sys, struct, sha, socket, os, time, base64, re, urllib2, binascii
 from mercurial import byterange
 from mercurial.transaction import *
 from mercurial.revlog import *
@@ -255,8 +255,8 @@
         if not self.remote:
             self.dircache = dircache(self.opener)
             try:
-                self.current = bin(self.open("current").read())
-            except:
+                self.current = bin(self.opener("current").read())
+            except IOError:
                 self.current = None
 
     def setcurrent(self, node):
@@ -477,12 +477,12 @@
     def diffdir(self, path):
         dc = self.dircache.copy()
         changed = []
+        mf = {}
         added = []
 
-        mmap = {}
         if self.current:
             change = self.changelog.read(self.current)
-            mmap = self.manifest.read(change[0])
+            mf = self.manifest.read(change[0])
 
         for dir, subdirs, files in os.walk(self.root):
             d = dir[len(self.root)+1:]
@@ -499,7 +499,7 @@
                         changed.append(fn)
                     elif c[0] != s.st_mode or c[2] != s.st_mtime:
                         t1 = file(fn).read()
-                        t2 = self.file(fn).revision(mmap[fn])
+                        t2 = self.file(fn).revision(mf[fn])
                         if t1 != t2:
                             changed.append(fn)
                 else: