/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2007-12-04 18:11:51 UTC
  • mfrom: (3074 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3075.
  • Revision ID: john@arbash-meinel.com-20071204181151-br85qwsgshso16q5
[merge] bzr.dev 3074

Show diffs side-by-side

added added

removed removed

Lines of Context:
1255
1255
        bzr init
1256
1256
        bzr add .
1257
1257
        bzr status
1258
 
        bzr commit -m 'imported project'
 
1258
        bzr commit -m "imported project"
1259
1259
    """
1260
1260
 
1261
1261
    _see_also = ['init-repository', 'branch', 'checkout']
1915
1915
 
1916
1916
        Ignore class files in all directories::
1917
1917
 
1918
 
            bzr ignore '*.class'
1919
 
 
1920
 
        Ignore .o files under the lib directory::
1921
 
 
1922
 
            bzr ignore 'lib/**/*.o'
1923
 
 
1924
 
        Ignore .o files under the lib directory::
1925
 
 
1926
 
            bzr ignore 'RE:lib/.*\.o'
 
1918
            bzr ignore "*.class"
 
1919
 
 
1920
        Ignore .o files under the lib directory::
 
1921
 
 
1922
            bzr ignore "lib/**/*.o"
 
1923
 
 
1924
        Ignore .o files under the lib directory::
 
1925
 
 
1926
            bzr ignore "RE:lib/.*\.o"
1927
1927
    """
1928
1928
 
1929
1929
    _see_also = ['status', 'ignored']
2444
2444
 
2445
2445
        Set the current user::
2446
2446
 
2447
 
            bzr whoami 'Frank Chu <fchu@example.com>'
 
2447
            bzr whoami "Frank Chu <fchu@example.com>"
2448
2448
    """
2449
2449
    takes_options = [ Option('email',
2450
2450
                             help='Display email address only.'),
3574
3574
    def run(self, location=None,
3575
3575
            dry_run=False, verbose=False,
3576
3576
            revision=None, force=False):
3577
 
        from bzrlib.log import log_formatter, show_log
3578
 
        from bzrlib.uncommit import uncommit
3579
 
 
3580
3577
        if location is None:
3581
3578
            location = u'.'
3582
3579
        control, relpath = bzrdir.BzrDir.open_containing(location)
3587
3584
            tree = None
3588
3585
            b = control.open_branch()
3589
3586
 
 
3587
        if tree is not None:
 
3588
            tree.lock_write()
 
3589
        else:
 
3590
            b.lock_write()
 
3591
        try:
 
3592
            return self._run(b, tree, dry_run, verbose, revision, force)
 
3593
        finally:
 
3594
            if tree is not None:
 
3595
                tree.unlock()
 
3596
            else:
 
3597
                b.unlock()
 
3598
 
 
3599
    def _run(self, b, tree, dry_run, verbose, revision, force):
 
3600
        from bzrlib.log import log_formatter, show_log
 
3601
        from bzrlib.uncommit import uncommit
 
3602
 
 
3603
        last_revno, last_rev_id = b.last_revision_info()
 
3604
 
3590
3605
        rev_id = None
3591
3606
        if revision is None:
3592
 
            revno = b.revno()
 
3607
            revno = last_revno
 
3608
            rev_id = last_rev_id
3593
3609
        else:
3594
3610
            # 'bzr uncommit -r 10' actually means uncommit
3595
3611
            # so that the final tree is at revno 10.
3596
3612
            # but bzrlib.uncommit.uncommit() actually uncommits
3597
3613
            # the revisions that are supplied.
3598
3614
            # So we need to offset it by one
3599
 
            revno = revision[0].in_history(b).revno+1
 
3615
            revno = revision[0].in_history(b).revno + 1
 
3616
            if revno <= last_revno:
 
3617
                rev_id = b.get_rev_id(revno)
3600
3618
 
3601
 
        if revno <= b.revno():
3602
 
            rev_id = b.get_rev_id(revno)
3603
3619
        if rev_id is None or _mod_revision.is_null(rev_id):
3604
3620
            self.outf.write('No revisions to uncommit.\n')
3605
3621
            return 1
3613
3629
                 verbose=False,
3614
3630
                 direction='forward',
3615
3631
                 start_revision=revno,
3616
 
                 end_revision=b.revno())
 
3632
                 end_revision=last_revno)
3617
3633
 
3618
3634
        if dry_run:
3619
3635
            print 'Dry-run, pretending to remove the above revisions.'
3628
3644
                    return 0
3629
3645
 
3630
3646
        uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
3631
 
                revno=revno)
 
3647
                 revno=revno)
3632
3648
 
3633
3649
 
3634
3650
class cmd_break_lock(Command):
4015
4031
                config = branch.get_config()
4016
4032
                if mail_to is None:
4017
4033
                    mail_to = config.get_user_option('submit_to')
4018
 
                if mail_to is None:
4019
 
                    raise errors.BzrCommandError('No mail-to address'
4020
 
                                                 ' specified')
4021
4034
                mail_client = config.get_mail_client()
4022
4035
            if remember and submit_branch is None:
4023
4036
                raise errors.BzrCommandError(
4303
4316
                     value_switches=True, enum_switch=False,
4304
4317
                     branch='Reconfigure to a branch.',
4305
4318
                     tree='Reconfigure to a tree.',
4306
 
                     checkout='Reconfigure to a checkout.'),
 
4319
                     checkout='Reconfigure to a checkout.',
 
4320
                     lightweight_checkout='Reconfigure to a lightweight'
 
4321
                     ' checkout.'),
4307
4322
                     Option('bind-to', help='Branch to bind checkout to.',
4308
4323
                            type=str),
4309
4324
                     Option('force',
4322
4337
        elif target_type == 'checkout':
4323
4338
            reconfiguration = reconfigure.Reconfigure.to_checkout(directory,
4324
4339
                                                                  bind_to)
 
4340
        elif target_type == 'lightweight-checkout':
 
4341
            reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
 
4342
                directory, bind_to)
4325
4343
        reconfiguration.apply(force)
4326
4344
 
4327
4345