827
827
tree = WorkingTree.open_containing(dir)[0]
828
828
tree.lock_write()
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()
2784
class cmd_serve(Command):
2785
"""Run the bzr server."""
2787
aliases = ['server']
2791
help='serve on stdin/out for use from inetd or sshd'),
2793
help='listen for connections on nominated port of the form '
2794
'[hostname:]portnumber. Passing 0 as the port number will '
2795
'result in a dynamically allocated port.',
2798
help='serve contents of directory',
2800
Option('allow-writes',
2801
help='By default the server is a readonly server. Supplying '
2802
'--allow-writes enables write access to the contents of '
2803
'the served directory and below. '
2807
def run(self, port=None, inet=False, directory=None, allow_writes=False):
2808
from bzrlib.transport import smart
2809
from bzrlib.transport import get_transport
2810
if directory is None:
2811
directory = os.getcwd()
2812
url = 'file://' + urlutils.escape(directory)
2813
if not allow_writes:
2814
url = 'readonly+' + url
2815
t = get_transport(url)
2817
server = smart.SmartStreamServer(sys.stdin, sys.stdout, t)
2818
elif port is not None:
2820
host, port = port.split(':')
2823
server = smart.SmartTCPServer(t, host=host, port=int(port))
2824
print 'listening on port: ', server.port
2827
raise BzrCommandError("bzr serve requires one of --inet or --port")
2784
2831
# command-line interpretation helper for merge-related commands
2785
2832
def merge(other_revision, base_revision,
2786
2833
check_clean=True, ignore_zero=False,