comparison tests/test_util.py @ 1078:1afd308b8f46

tests: remove ability to toggle stupidity on less than class level
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 07 Aug 2013 23:16:39 +0200
parents 0932bb4d8870
children 661f4065bfbf
comparison
equal deleted inserted replaced
1077:8f3a241b790d 1078:1afd308b8f46
412 os.chdir(self.oldwd) 412 os.chdir(self.oldwd)
413 setattr(ui.ui, self.patch[0].func_name, self.patch[0]) 413 setattr(ui.ui, self.patch[0].func_name, self.patch[0])
414 414
415 _verify_our_modules() 415 _verify_our_modules()
416 416
417 def ui(self, stupid=False, layout='auto'): 417 def ui(self, layout='auto'):
418 return testui(self.stupid or stupid, layout) 418 return testui(self.stupid, layout)
419 419
420 def load_svndump(self, fixture_name): 420 def load_svndump(self, fixture_name):
421 '''Loads an svnadmin dump into a fresh repo. Return the svn repo 421 '''Loads an svnadmin dump into a fresh repo. Return the svn repo
422 path. 422 path.
423 ''' 423 '''
446 # it seems to work 446 # it seems to work
447 for entry in tarball: 447 for entry in tarball:
448 tarball.extract(entry, path) 448 tarball.extract(entry, path)
449 return path 449 return path
450 450
451 def fetch(self, repo_path, subdir=None, stupid=False, layout='auto', 451 def fetch(self, repo_path, subdir=None, layout='auto',
452 startrev=0, externals=None, noupdate=True, dest=None, rev=None, 452 startrev=0, externals=None, noupdate=True, dest=None, rev=None,
453 config=None): 453 config=None):
454 if layout == 'single': 454 if layout == 'single':
455 if subdir is None: 455 if subdir is None:
456 subdir = 'trunk' 456 subdir = 'trunk'
465 '--layout=%s' % layout, 465 '--layout=%s' % layout,
466 '--startrev=%s' % startrev, 466 '--startrev=%s' % startrev,
467 fileurl(projectpath), 467 fileurl(projectpath),
468 self.wc_path, 468 self.wc_path,
469 ] 469 ]
470 if self.stupid or stupid: 470 if self.stupid:
471 cmd.append('--stupid') 471 cmd.append('--stupid')
472 if noupdate: 472 if noupdate:
473 cmd.append('--noupdate') 473 cmd.append('--noupdate')
474 if rev is not None: 474 if rev is not None:
475 cmd.append('--rev=%s' % rev) 475 cmd.append('--rev=%s' % rev)
523 # define this as a property so that it reloads anytime we need it 523 # define this as a property so that it reloads anytime we need it
524 @property 524 @property
525 def repo(self): 525 def repo(self):
526 return hg.repository(testui(), self.wc_path) 526 return hg.repository(testui(), self.wc_path)
527 527
528 def pushrevisions(self, stupid=False, expected_extra_back=0): 528 def pushrevisions(self, expected_extra_back=0):
529 before = repolen(self.repo) 529 before = repolen(self.repo)
530 self.repo.ui.setconfig('hgsubversion', 'stupid', 530 self.repo.ui.setconfig('hgsubversion', 'stupid', str(self.stupid))
531 str(self.stupid or stupid))
532 res = commands.push(self.repo.ui, self.repo) 531 res = commands.push(self.repo.ui, self.repo)
533 after = repolen(self.repo) 532 after = repolen(self.repo)
534 self.assertEqual(expected_extra_back, after - before) 533 self.assertEqual(expected_extra_back, after - before)
535 return res 534 return res
536 535