~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revisionspec.py

  • Committer: Martin Pool
  • Date: 2008-12-16 07:56:29 UTC
  • mto: (3882.7.11 progress)
  • mto: This revision was merged to the branch mainline in revision 3940.
  • Revision ID: mbp@sourcefrog.net-20081216075629-zhgjzxgoh32453tu
Choose the UIFactory class depending on the terminal capabilities

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import datetime
18
18
import os
176
176
 
177
177
    def test_dotted_decimal(self):
178
178
        self.assertInHistoryIs(None, 'alt_r2', '1.1.1')
179
 
        self.assertInvalid('1.1.123')
180
179
 
181
180
    def test_negative_int(self):
182
181
        self.assertInHistoryIs(2, 'r2', '-1')
276
275
        """Old revno:N:path tests"""
277
276
        wta = self.make_branch_and_tree('a')
278
277
        ba = wta.branch
279
 
 
 
278
        
280
279
        wta.commit('Commit one', rev_id='a@r-0-1')
281
280
        wta.commit('Commit two', rev_id='a@r-0-2')
282
281
        wta.commit('Commit three', rev_id='a@r-0-3')
324
323
 
325
324
 
326
325
class TestRevisionSpec_revid(TestRevisionSpec):
327
 
 
 
326
    
328
327
    def test_in_history(self):
329
328
        # We should be able to access revisions that are directly
330
329
        # in the history.
331
330
        self.assertInHistoryIs(1, 'r1', 'revid:r1')
332
331
        self.assertInHistoryIs(2, 'r2', 'revid:r2')
333
 
 
 
332
        
334
333
    def test_missing(self):
335
334
        self.assertInvalid('revid:r3', invalid_as_revision_id=False)
336
335
 
437
436
 
438
437
 
439
438
class TestRevisionSpec_tag(TestRevisionSpec):
440
 
 
 
439
    
441
440
    def make_branch_and_tree(self, relpath):
442
441
        # override format as the default one may not support tags
443
442
        return TestRevisionSpec.make_branch_and_tree(
509
508
 
510
509
 
511
510
class TestRevisionSpec_ancestor(TestRevisionSpec):
512
 
 
 
511
    
513
512
    def test_non_exact_branch(self):
514
513
        # It seems better to require an exact path to the branch
515
514
        # Branch.open() rather than using Branch.open_containing()
545
544
        self.assertRaises(errors.NoCommits,
546
545
                          spec_in_history, 'ancestor:new_tree',
547
546
                                           self.tree.branch)
548
 
 
 
547
                        
549
548
        self.assertRaises(errors.NoCommits,
550
549
                          spec_in_history, 'ancestor:tree',
551
550
                                           new_tree.branch)
553
552
    def test_as_revision_id(self):
554
553
        self.assertAsRevisionId('alt_r2', 'ancestor:tree2')
555
554
 
556
 
    def test_default(self):
557
 
        # We don't have a parent to default to
558
 
        self.assertRaises(errors.NotBranchError, self.get_in_history,
559
 
                          'ancestor:')
560
 
 
561
 
        # Create a branch with a parent to default to
562
 
        tree3 = self.tree.bzrdir.sprout('tree3').open_workingtree()
563
 
        tree3.commit('foo', rev_id='r3')
564
 
        self.tree = tree3
565
 
        self.assertInHistoryIs(2, 'r2', 'ancestor:')
566
 
 
567
555
 
568
556
class TestRevisionSpec_branch(TestRevisionSpec):
569
 
 
 
557
    
570
558
    def test_non_exact_branch(self):
571
559
        # It seems better to require an exact path to the branch
572
560
        # Branch.open() rather than using Branch.open_containing()