##// END OF EJS Templates
sparse: use vfs.tryread()...
Gregory Szorc -
r33296:ee616196 default
parent child Browse files
Show More
@@ -445,13 +445,13 b' def _wraprepo(ui, repo):'
445 """Returns the include/exclude patterns specified by the
445 """Returns the include/exclude patterns specified by the
446 given rev.
446 given rev.
447 """
447 """
448 if not self.vfs.exists('sparse'):
448 raw = self.vfs.tryread('sparse')
449 if not raw:
449 return set(), set(), []
450 return set(), set(), []
450 if rev is None:
451 if rev is None:
451 raise error.Abort(_("cannot parse sparse patterns from " +
452 raise error.Abort(_("cannot parse sparse patterns from " +
452 "working copy"))
453 "working copy"))
453
454
454 raw = self.vfs.read('sparse')
455 includes, excludes, profiles = self.readsparseconfig(raw)
455 includes, excludes, profiles = self.readsparseconfig(raw)
456
456
457 ctx = self[rev]
457 ctx = self[rev]
@@ -623,8 +623,8 b' def _wraprepo(ui, repo):'
623
623
624 def gettemporaryincludes(self):
624 def gettemporaryincludes(self):
625 existingtemp = set()
625 existingtemp = set()
626 if self.vfs.exists('tempsparse'):
626 raw = self.vfs.tryread('tempsparse')
627 raw = self.vfs.read('tempsparse')
627 if raw:
628 existingtemp.update(raw.split('\n'))
628 existingtemp.update(raw.split('\n'))
629 return existingtemp
629 return existingtemp
630
630
@@ -784,8 +784,8 b' def _config(ui, repo, pats, opts, includ'
784 try:
784 try:
785 oldsparsematch = repo.sparsematch()
785 oldsparsematch = repo.sparsematch()
786
786
787 if repo.vfs.exists('sparse'):
787 raw = repo.vfs.tryread('sparse')
788 raw = repo.vfs.read('sparse')
788 if raw:
789 oldinclude, oldexclude, oldprofiles = map(
789 oldinclude, oldexclude, oldprofiles = map(
790 set, repo.readsparseconfig(raw))
790 set, repo.readsparseconfig(raw))
791 else:
791 else:
@@ -845,9 +845,7 b' def _import(ui, repo, files, opts, force'
845 repo.dirstate.parents() if node != nullid]
845 repo.dirstate.parents() if node != nullid]
846
846
847 # read current configuration
847 # read current configuration
848 raw = ''
848 raw = repo.vfs.tryread('sparse')
849 if repo.vfs.exists('sparse'):
850 raw = repo.vfs.read('sparse')
851 oincludes, oexcludes, oprofiles = repo.readsparseconfig(raw)
849 oincludes, oexcludes, oprofiles = repo.readsparseconfig(raw)
852 includes, excludes, profiles = map(
850 includes, excludes, profiles = map(
853 set, (oincludes, oexcludes, oprofiles))
851 set, (oincludes, oexcludes, oprofiles))
@@ -898,9 +896,7 b' def _import(ui, repo, files, opts, force'
898
896
899 def _clear(ui, repo, files, force=False):
897 def _clear(ui, repo, files, force=False):
900 with repo.wlock():
898 with repo.wlock():
901 raw = ''
899 raw = repo.vfs.tryread('sparse')
902 if repo.vfs.exists('sparse'):
903 raw = repo.vfs.read('sparse')
904 includes, excludes, profiles = repo.readsparseconfig(raw)
900 includes, excludes, profiles = repo.readsparseconfig(raw)
905
901
906 if includes or excludes:
902 if includes or excludes:
General Comments 0
You need to be logged in to leave comments. Login now