示例#1
0
 def test_get_set_stacked_on_relative(self):
     # Branches can be stacked on other branches using relative paths.
     branch = self.make_branch('branch')
     target = self.make_branch('target')
     try:
         branch.set_stacked_on_url('../target')
     except unstackable_format_errors:
         # if the set failed, so must the get
         self.assertRaises(unstackable_format_errors, branch.get_stacked_on_url)
         return
     self.assertEqual('../target', branch.get_stacked_on_url())
示例#2
0
 def apply(self, bzrdir):
     branch = bzrdir.open_branch()
     branch.lock_write()
     try:
         branch.set_stacked_on_url(None)
         if not trace.is_quiet():
             ui.ui_factory.note(gettext(
                 "%s is now not stacked\n")
                 % (branch.base,))
     finally:
         branch.unlock()
 def test_get_set_stacked_on_relative(self):
     # Branches can be stacked on other branches using relative paths.
     branch = self.make_branch('branch')
     target = self.make_branch('target')
     try:
         branch.set_stacked_on_url('../target')
     except unstackable_format_errors:
         # if the set failed, so must the get
         self.assertRaises(unstackable_format_errors,
                           branch.get_stacked_on_url)
         return
     self.assertEqual('../target', branch.get_stacked_on_url())
示例#4
0
 def test_set_stacked_on_same_branch_after_being_stacked_raises(self):
     # Stacking on the same branch silently raises and doesn't execute the
     # change.
     branch = self.make_branch('branch')
     target = self.make_branch('target')
     try:
         branch.set_stacked_on_url('../target')
     except unstackable_format_errors:
         # if the set failed, so must the get
         self.assertRaises(unstackable_format_errors, branch.get_stacked_on_url)
         return
     self.assertRaises(errors.UnstackableLocationError,
         branch.set_stacked_on_url, '../branch')
     self.assertEqual('../target', branch.get_stacked_on_url())
 def test_set_stacked_on_same_branch_after_being_stacked_raises(self):
     # Stacking on the same branch silently raises and doesn't execute the
     # change.
     branch = self.make_branch('branch')
     target = self.make_branch('target')
     try:
         branch.set_stacked_on_url('../target')
     except unstackable_format_errors:
         # if the set failed, so must the get
         self.assertRaises(unstackable_format_errors,
                           branch.get_stacked_on_url)
         return
     self.assertRaises(errors.UnstackableLocationError,
                       branch.set_stacked_on_url, '../branch')
     self.assertEqual('../target', branch.get_stacked_on_url())
示例#6
0
 def apply(self, bzrdir, stacked_on_url):
     branch = bzrdir.open_branch()
     # it may be a path relative to the cwd or a url; the branch wants
     # a path relative to itself...
     on_url = urlutils.relative_url(branch.base,
         urlutils.normalize_url(stacked_on_url))
     branch.lock_write()
     try:
         branch.set_stacked_on_url(on_url)
         if not trace.is_quiet():
             ui.ui_factory.note(gettext(
                 "{0} is now stacked on {1}\n").format(
                   branch.base, branch.get_stacked_on_url()))
     finally:
         branch.unlock()
示例#7
0
 def test_get_set_stacked_on_url(self):
     # branches must either:
     # raise UnstackableBranchFormat or
     # raise UnstackableRepositoryFormat or
     # permit stacking to be done and then return the stacked location.
     branch = self.make_branch('branch')
     target = self.make_branch('target')
     try:
         branch.set_stacked_on_url(target.base)
     except unstackable_format_errors:
         # if the set failed, so must the get
         self.assertRaises(unstackable_format_errors, branch.get_stacked_on_url)
         self.assertFalse(branch._format.supports_stacking())
         return
     self.assertTrue(branch._format.supports_stacking())
     # now we have a stacked branch:
     self.assertEqual(target.base, branch.get_stacked_on_url())
     branch.set_stacked_on_url(None)
     self.assertRaises(errors.NotStacked, branch.get_stacked_on_url)
 def test_get_set_stacked_on_url(self):
     # branches must either:
     # raise UnstackableBranchFormat or
     # raise UnstackableRepositoryFormat or
     # permit stacking to be done and then return the stacked location.
     branch = self.make_branch('branch')
     target = self.make_branch('target')
     try:
         branch.set_stacked_on_url(target.base)
     except unstackable_format_errors:
         # if the set failed, so must the get
         self.assertRaises(unstackable_format_errors,
                           branch.get_stacked_on_url)
         self.assertFalse(branch._format.supports_stacking())
         return
     self.assertTrue(branch._format.supports_stacking())
     # now we have a stacked branch:
     self.assertEqual(target.base, branch.get_stacked_on_url())
     branch.set_stacked_on_url(None)
     self.assertRaises(errors.NotStacked, branch.get_stacked_on_url)