diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -472,17 +472,27 @@ def patch(ui, repo, patch1, *patches, ** addremove(ui, repo, *files) repo.commit(files, text) -def pull(ui, repo, source="default"): +def pull(ui, repo, source="default", **opts): """pull changes from the specified source""" paths = {} for name, path in ui.configitems("paths"): paths[name] = path - if source in paths: source = paths[source] + if source in paths: + source = paths[source] + + ui.status('pulling from %s\n' % (source)) other = hg.repository(ui, source) cg = repo.getchangegroup(other) - repo.addchangegroup(cg) + r = repo.addchangegroup(cg) + if cg and not r: + if opts['update']: + return update(ui, repo) + else: + ui.status("(run 'hg update' to get a working copy)\n") + + return r def push(ui, repo, dest="default-push"): """push changes to the specified destination""" @@ -678,7 +688,9 @@ table = { ('b', 'base', "", 'base path'), ('q', 'quiet', "", 'silence diff')], "hg import [options] patches"), - "pull|merge": (pull, [], 'hg pull [source]'), + "pull|merge": (pull, + [('u', 'update', None, 'update working directory')], + 'hg pull [options] [source]'), "push": (push, [], 'hg push '), "rawcommit": (rawcommit, [('p', 'parent', [], 'parent'), diff --git a/tests/test-simple-update.out b/tests/test-simple-update.out --- a/tests/test-simple-update.out +++ b/tests/test-simple-update.out @@ -19,11 +19,13 @@ 1 files, 1 changesets, 1 total revisions + hg commit -t 2 + cd ../test + hg pull ../branch +pulling from ../branch searching for changes adding changesets adding manifests adding file revisions modified 1 files, added 1 changesets and 1 new revisions +(run 'hg update' to get a working copy) + hg verify checking changesets checking manifests