Example #1
0
 def test_commit_in_heavyweight_checkout_copies_tags_to_master(self):
     master, child = self.make_master_and_checkout()
     fork = self.make_fork(master)
     fork.tags.set_tag('new-tag', fork.last_revision())
     fork.tags.set_tag('non-ancestry-tag', b'fork-0')
     fork.tags.set_tag('absent-tag', b'absent-rev')
     script.run_script(self,
                       """
         $ cd child
         $ brz merge ../fork
         $ brz commit -m "Merge fork."
         2>Committing to: .../master/
         2>Committed revision 2.
         """,
                       null_output_matches_anything=True)
     # Merge copied the tag to child and commit propagated it to master
     expected_tag_dict = {
         'new-tag': fork.last_revision(),
         'non-ancestry-tag': b'fork-0',
         'absent-tag': b'absent-rev',
     }
     self.assertEqual(expected_tag_dict, child.branch.tags.get_tag_dict())
     self.assertEqual(expected_tag_dict, master.tags.get_tag_dict())
     # Revisions not in ancestry but named in tags are present
     child.branch.repository.get_revision(b'fork-0')
     master.repository.get_revision(b'fork-0')
Example #2
0
 def test_clean_tree_interactive(self):
     wt = self.make_branch_and_tree('.')
     self.touch('bar')
     self.touch('foo')
     run_script(self, """
     $ brz clean-tree
     bar
     foo
     2>Are you sure you wish to delete these? ([y]es, [n]o): no
     <n
     Canceled
     """)
     self.assertPathExists('bar')
     self.assertPathExists('foo')
     run_script(self, """
     $ brz clean-tree
     bar
     foo
     2>Are you sure you wish to delete these? ([y]es, [n]o): yes
     <y
     2>deleting paths:
     2>  bar
     2>  foo
     """)
     self.assertPathDoesNotExist('bar')
     self.assertPathDoesNotExist('foo')
Example #3
0
 def test_break_lock_no_interaction(self):
     """With --force, the user isn't asked for confirmation"""
     self.master_branch.lock_write()
     run_script(
         self, """
     $ brz break-lock --force master-repo/master-branch
     Broke lock ...master-branch/.bzr/...
     """)
     # lock should now be dead
     self.assertRaises(errors.LockBroken, self.master_branch.unlock)
Example #4
0
 def test_uncommit_interactive(self):
     """Uncommit seeks confirmation, and doesn't proceed without it."""
     wt = self.create_simple_tree()
     os.chdir('tree')
     run_script(self, """
     $ brz uncommit
     ...
     The above revision(s) will be removed.
     2>Uncommit these revisions? ([y]es, [n]o): no
     <n
     Canceled
     """)
     self.assertEqual([b'a2'], wt.get_parent_ids())
Example #5
0
 def test_commit_in_heavyweight_checkout_reports_tag_conflict(self):
     master, child = self.make_master_and_checkout()
     fork = self.make_fork(master)
     fork.tags.set_tag('new-tag', fork.last_revision())
     master_r1 = master.last_revision()
     master.tags.set_tag('new-tag', master_r1)
     script.run_script(self, """
         $ cd child
         $ brz merge ../fork
         $ brz commit -m "Merge fork."
         2>Committing to: .../master/
         2>Conflicting tags in bound branch:
         2>    new-tag
         2>Committed revision 2.
         """, null_output_matches_anything=True)
     # Merge copied the tag to child.  master's conflicting tag is unchanged.
     self.assertEqual(
         {'new-tag': fork.last_revision()}, child.branch.tags.get_tag_dict())
     self.assertEqual(
         {'new-tag': master_r1}, master.tags.get_tag_dict())