~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
827
827
        tree = WorkingTree.open_containing(dir)[0]
828
828
        tree.lock_write()
829
829
        try:
830
 
            existing_pending_merges = tree.pending_merges()
 
830
            existing_pending_merges = tree.get_parent_ids()[1:]
831
831
            last_rev = tree.last_revision()
832
832
            if last_rev == tree.branch.last_revision():
833
833
                # may be up to date, check master too.
839
839
            conflicts = tree.update()
840
840
            revno = tree.branch.revision_id_to_revno(tree.last_revision())
841
841
            note('Updated to revision %d.' % (revno,))
842
 
            if tree.pending_merges() != existing_pending_merges:
 
842
            if tree.get_parent_ids()[1:] != existing_pending_merges:
843
843
                note('Your local commits will now show as pending merges with '
844
844
                     "'bzr status', and can be committed with 'bzr commit'.")
845
845
            if conflicts != 0:
2781
2781
        sys.stdin.readline()
2782
2782
 
2783
2783
 
 
2784
class cmd_serve(Command):
 
2785
    """Run the bzr server.
 
2786
    """
 
2787
    takes_options = [
 
2788
        Option('inet',
 
2789
               help='serve on stdin/out for use from inetd or sshd'),
 
2790
        Option('port',
 
2791
               help='listen for connections on nominated port of the form '
 
2792
                    '[hostname:]portnumber. Passing 0 as the port number will '
 
2793
                    'result in a dynamically allocated port.',
 
2794
               type=str),
 
2795
        Option('directory',
 
2796
               help='serve contents of directory',
 
2797
               type=unicode),
 
2798
        ]
 
2799
 
 
2800
    def run(self, port=None, inet=False, directory=None):
 
2801
        from bzrlib.transport import smart
 
2802
        from bzrlib.transport import get_transport
 
2803
        if directory is None:
 
2804
            directory = os.getcwd()
 
2805
        t = get_transport(directory)
 
2806
        if inet:
 
2807
            server = smart.SmartStreamServer(sys.stdin, sys.stdout, t)
 
2808
        elif port is not None:
 
2809
            if ':' in port:
 
2810
                host, port = port.split(':')
 
2811
            else:
 
2812
                host = '127.0.0.1'
 
2813
            server = smart.SmartTCPServer(t, host=host, port=int(port))
 
2814
            print 'listening on port: ', server.port
 
2815
            sys.stdout.flush()
 
2816
        else:
 
2817
            raise BzrCommandError("bzr serve requires one of --inet or --port")
 
2818
        server.serve()
 
2819
 
 
2820
 
2784
2821
# command-line interpretation helper for merge-related commands
2785
2822
def merge(other_revision, base_revision,
2786
2823
          check_clean=True, ignore_zero=False,