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