##// END OF EJS Templates
localrepo: remove all internal uses of localrepo.opener...
Angel Ezquerra -
r23852:99e12562 default
parent child Browse files
Show More
@@ -325,7 +325,7 b' class localrepository(object):'
325 self.sopener.options['maxchainlen'] = maxchainlen
325 self.sopener.options['maxchainlen'] = maxchainlen
326
326
327 def _writerequirements(self):
327 def _writerequirements(self):
328 reqfile = self.opener("requires", "w")
328 reqfile = self.vfs("requires", "w")
329 for r in sorted(self.requirements):
329 for r in sorted(self.requirements):
330 reqfile.write("%s\n" % r)
330 reqfile.write("%s\n" % r)
331 reqfile.close()
331 reqfile.close()
@@ -449,7 +449,7 b' class localrepository(object):'
449 " working parent %s!\n") % short(node))
449 " working parent %s!\n") % short(node))
450 return nullid
450 return nullid
451
451
452 return dirstate.dirstate(self.opener, self.ui, self.root, validate)
452 return dirstate.dirstate(self.vfs, self.ui, self.root, validate)
453
453
454 def __getitem__(self, changeid):
454 def __getitem__(self, changeid):
455 if changeid is None:
455 if changeid is None:
@@ -531,9 +531,9 b' class localrepository(object):'
531 prevtags = ''
531 prevtags = ''
532 if local:
532 if local:
533 try:
533 try:
534 fp = self.opener('localtags', 'r+')
534 fp = self.vfs('localtags', 'r+')
535 except IOError:
535 except IOError:
536 fp = self.opener('localtags', 'a')
536 fp = self.vfs('localtags', 'a')
537 else:
537 else:
538 prevtags = fp.read()
538 prevtags = fp.read()
539
539
@@ -909,7 +909,7 b' class localrepository(object):'
909 self._writejournal(desc)
909 self._writejournal(desc)
910 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
910 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
911 rp = report and report or self.ui.warn
911 rp = report and report or self.ui.warn
912 vfsmap = {'plain': self.opener} # root of .hg/
912 vfsmap = {'plain': self.vfs} # root of .hg/
913 tr = transaction.transaction(rp, self.sopener, vfsmap,
913 tr = transaction.transaction(rp, self.sopener, vfsmap,
914 "journal",
914 "journal",
915 aftertrans(renames),
915 aftertrans(renames),
@@ -933,14 +933,14 b' class localrepository(object):'
933 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
933 return [(vfs, undoname(x)) for vfs, x in self._journalfiles()]
934
934
935 def _writejournal(self, desc):
935 def _writejournal(self, desc):
936 self.opener.write("journal.dirstate",
936 self.vfs.write("journal.dirstate",
937 self.opener.tryread("dirstate"))
937 self.vfs.tryread("dirstate"))
938 self.opener.write("journal.branch",
938 self.vfs.write("journal.branch",
939 encoding.fromlocal(self.dirstate.branch()))
939 encoding.fromlocal(self.dirstate.branch()))
940 self.opener.write("journal.desc",
940 self.vfs.write("journal.desc",
941 "%d\n%s\n" % (len(self), desc))
941 "%d\n%s\n" % (len(self), desc))
942 self.opener.write("journal.bookmarks",
942 self.vfs.write("journal.bookmarks",
943 self.opener.tryread("bookmarks"))
943 self.vfs.tryread("bookmarks"))
944 self.sopener.write("journal.phaseroots",
944 self.sopener.write("journal.phaseroots",
945 self.sopener.tryread("phaseroots"))
945 self.sopener.tryread("phaseroots"))
946
946
@@ -950,7 +950,7 b' class localrepository(object):'
950 if self.svfs.exists("journal"):
950 if self.svfs.exists("journal"):
951 self.ui.status(_("rolling back interrupted transaction\n"))
951 self.ui.status(_("rolling back interrupted transaction\n"))
952 vfsmap = {'': self.sopener,
952 vfsmap = {'': self.sopener,
953 'plain': self.opener,}
953 'plain': self.vfs,}
954 transaction.rollback(self.sopener, vfsmap, "journal",
954 transaction.rollback(self.sopener, vfsmap, "journal",
955 self.ui.warn)
955 self.ui.warn)
956 self.invalidate()
956 self.invalidate()
@@ -978,7 +978,7 b' class localrepository(object):'
978 def _rollback(self, dryrun, force):
978 def _rollback(self, dryrun, force):
979 ui = self.ui
979 ui = self.ui
980 try:
980 try:
981 args = self.opener.read('undo.desc').splitlines()
981 args = self.vfs.read('undo.desc').splitlines()
982 (oldlen, desc, detail) = (int(args[0]), args[1], None)
982 (oldlen, desc, detail) = (int(args[0]), args[1], None)
983 if len(args) >= 3:
983 if len(args) >= 3:
984 detail = args[2]
984 detail = args[2]
@@ -1007,7 +1007,7 b' class localrepository(object):'
1007
1007
1008 parents = self.dirstate.parents()
1008 parents = self.dirstate.parents()
1009 self.destroying()
1009 self.destroying()
1010 vfsmap = {'plain': self.opener}
1010 vfsmap = {'plain': self.vfs}
1011 transaction.rollback(self.sopener, vfsmap, 'undo', ui.warn)
1011 transaction.rollback(self.sopener, vfsmap, 'undo', ui.warn)
1012 if self.vfs.exists('undo.bookmarks'):
1012 if self.vfs.exists('undo.bookmarks'):
1013 self.vfs.rename('undo.bookmarks', 'bookmarks')
1013 self.vfs.rename('undo.bookmarks', 'bookmarks')
@@ -1020,7 +1020,7 b' class localrepository(object):'
1020 if parentgone:
1020 if parentgone:
1021 self.vfs.rename('undo.dirstate', 'dirstate')
1021 self.vfs.rename('undo.dirstate', 'dirstate')
1022 try:
1022 try:
1023 branch = self.opener.read('undo.branch')
1023 branch = self.vfs.read('undo.branch')
1024 self.dirstate.setbranch(encoding.tolocal(branch))
1024 self.dirstate.setbranch(encoding.tolocal(branch))
1025 except IOError:
1025 except IOError:
1026 ui.warn(_('named branch could not be reset: '
1026 ui.warn(_('named branch could not be reset: '
@@ -1822,7 +1822,7 b' class localrepository(object):'
1822 return "%s %s %s %s %s" % (one, two, three, four, five)
1822 return "%s %s %s %s %s" % (one, two, three, four, five)
1823
1823
1824 def savecommitmessage(self, text):
1824 def savecommitmessage(self, text):
1825 fp = self.opener('last-message.txt', 'wb')
1825 fp = self.vfs('last-message.txt', 'wb')
1826 try:
1826 try:
1827 fp.write(text)
1827 fp.write(text)
1828 finally:
1828 finally:
General Comments 0
You need to be logged in to leave comments. Login now