summaryrefslogtreecommitdiff
path: root/hgext/fetch.py
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2011-10-01 20:49:36 +0000
committerLorry <lorry@roadtrain.codethink.co.uk>2012-09-27 13:27:51 +0000
commit921ced43c48c1d170452a7b251b94cc96ec8dd44 (patch)
tree3c4a89176ea67fe4c7bf7b375488361a823c95fa /hgext/fetch.py
parent9039c805b0a7e36220101323f82735f08a104b37 (diff)
downloadmercurial-tarball-921ced43c48c1d170452a7b251b94cc96ec8dd44.tar.gz
Imported from /srv/lorry/lorry-area/mercurial-tarball/mercurial-1.9.3.tar.gz.HEADmercurial-1.9.3master
Diffstat (limited to 'hgext/fetch.py')
-rw-r--r--hgext/fetch.py25
1 files changed, 9 insertions, 16 deletions
diff --git a/hgext/fetch.py b/hgext/fetch.py
index 491d8b2..23061cd 100644
--- a/hgext/fetch.py
+++ b/hgext/fetch.py
@@ -5,15 +5,13 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
-'''pull, update and merge in one command (DEPRECATED)'''
+'''pull, update and merge in one command'''
from mercurial.i18n import _
from mercurial.node import nullid, short
from mercurial import commands, cmdutil, hg, util, error
from mercurial.lock import release
-testedwith = 'internal'
-
def fetch(ui, repo, source='default', **opts):
'''pull changes from a remote repository, merge new changes if needed.
@@ -25,9 +23,10 @@ def fetch(ui, repo, source='default', **opts):
Otherwise, the working directory is updated to include the new
changes.
- When a merge is needed, the working directory is first updated to
- the newly pulled changes. Local changes are then merged into the
- pulled changes. To switch the merge order, use --switch-parent.
+ When a merge occurs, the newly pulled changes are assumed to be
+ "authoritative". The head of the new changes is used as the first
+ parent, with local changes as the second. To switch the merge
+ order, use --switch-parent.
See :hg:`help dates` for a list of formats valid for -d/--date.
@@ -40,10 +39,7 @@ def fetch(ui, repo, source='default', **opts):
parent, p2 = repo.dirstate.parents()
branch = repo.dirstate.branch()
- try:
- branchnode = repo.branchtip(branch)
- except error.RepoLookupError:
- branchnode = None
+ branchnode = repo.branchtags().get(branch)
if parent != branchnode:
raise util.Abort(_('working dir not at branch tip '
'(use "hg update" to check out branch tip)'))
@@ -75,7 +71,7 @@ def fetch(ui, repo, source='default', **opts):
try:
revs = [other.lookup(rev) for rev in opts['rev']]
except error.CapabilityError:
- err = _("other repository doesn't support revision lookup, "
+ err = _("Other repository doesn't support revision lookup, "
"so a rev cannot be specified.")
raise util.Abort(err)
@@ -87,9 +83,9 @@ def fetch(ui, repo, source='default', **opts):
# Is this a simple fast-forward along the current branch?
newheads = repo.branchheads(branch)
newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
- if len(newheads) == 1 and len(newchildren):
+ if len(newheads) == 1:
if newchildren[0] != parent:
- return hg.update(repo, newchildren[0])
+ return hg.clean(repo, newchildren[0])
else:
return 0
@@ -106,9 +102,6 @@ def fetch(ui, repo, source='default', **opts):
(len(newheads) - 1))
return 1
- if not newheads:
- return 0
-
# Otherwise, let's merge.
err = False
if newheads: