##// END OF EJS Templates
Add wopener for opening files in the working directory...
mpm@selenic.com -
r291:2c4f2be0 default
parent child Browse files
Show More
@@ -318,6 +318,7 b' class localrepository:'
318 os.mkdir(self.join("data"))
318 os.mkdir(self.join("data"))
319
319
320 self.opener = opener(self.path)
320 self.opener = opener(self.path)
321 self.wopener = opener(self.root)
321 self.manifest = manifest(self.opener)
322 self.manifest = manifest(self.opener)
322 self.changelog = changelog(self.opener)
323 self.changelog = changelog(self.opener)
323 self.ignorelist = None
324 self.ignorelist = None
@@ -330,7 +331,7 b' class localrepository:'
330 if self.ignorelist is None:
331 if self.ignorelist is None:
331 self.ignorelist = []
332 self.ignorelist = []
332 try:
333 try:
333 l = open(os.path.join(self.root, ".hgignore"))
334 l = self.wfile(".hgignore")
334 for pat in l:
335 for pat in l:
335 if pat != "\n":
336 if pat != "\n":
336 self.ignorelist.append(re.compile(pat[:-1]))
337 self.ignorelist.append(re.compile(pat[:-1]))
@@ -370,6 +371,9 b' class localrepository:'
370 if f[0] == '/': f = f[1:]
371 if f[0] == '/': f = f[1:]
371 return filelog(self.opener, f)
372 return filelog(self.opener, f)
372
373
374 def wfile(self, f, mode='r'):
375 return self.wopener(f, mode)
376
373 def transaction(self):
377 def transaction(self):
374 # save dirstate for undo
378 # save dirstate for undo
375 try:
379 try:
@@ -526,7 +530,7 b' class localrepository:'
526 dc = self.dirstate.copy()
530 dc = self.dirstate.copy()
527
531
528 def fcmp(fn):
532 def fcmp(fn):
529 t1 = file(self.wjoin(fn)).read()
533 t1 = self.wfile(fn).read()
530 t2 = self.file(fn).revision(mf[fn])
534 t2 = self.file(fn).revision(mf[fn])
531 return cmp(t1, t2)
535 return cmp(t1, t2)
532
536
@@ -991,13 +995,12 b' class localrepository:'
991 if f[0] == "/": continue
995 if f[0] == "/": continue
992 self.ui.note("getting %s\n" % f)
996 self.ui.note("getting %s\n" % f)
993 t = self.file(f).read(get[f])
997 t = self.file(f).read(get[f])
994 wp = self.wjoin(f)
995 try:
998 try:
996 file(wp, "w").write(t)
999 self.wfile(f, "w").write(t)
997 except IOError:
1000 except IOError:
998 os.makedirs(os.path.dirname(wp))
1001 os.makedirs(os.path.dirname(wp))
999 file(wp, "w").write(t)
1002 self.wfile(f, "w").write(t)
1000 set_exec(wp, mf2[f])
1003 set_exec(self.wjoin(f), mf2[f])
1001 self.dirstate.update([f], mode)
1004 self.dirstate.update([f], mode)
1002
1005
1003 # merge the tricky bits
1006 # merge the tricky bits
General Comments 0
You need to be logged in to leave comments. Login now