comparison buttercup/source.py @ 34:7a11a25da2e8

better assertion message
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 12 Jun 2011 19:01:15 -0700
parents 6089d6ec745a
children 052ee8a2ebde
comparison
equal deleted inserted replaced
33:f3878c2f7032 34:7a11a25da2e8
34 """mercurial source""" 34 """mercurial source"""
35 35
36 def update(self): 36 def update(self):
37 """updates a checkout or does one if it does not exist""" 37 """updates a checkout or does one if it does not exist"""
38 if os.path.exists(self.directory()): 38 if os.path.exists(self.directory()):
39 assert os.path.exists(os.path.join(self.directory(), '.hg')) 39 hgdir = os.path.join(self.directory(), '.hg'))
40 assert os.path.exists(hgdir), "Not an hg directory: %s" % hgdir
40 call(['hg', 'pull'], cwd=self.directory()) 41 call(['hg', 'pull'], cwd=self.directory())
41 call(['hg', 'update'], cwd=self.directory()) 42 call(['hg', 'update'], cwd=self.directory())
42 else: 43 else:
43 if not os.path.exists(self.srcdir): 44 if not os.path.exists(self.srcdir):
44 os.makedirs(self.srcdir) 45 os.makedirs(self.srcdir)