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