hgext/fetch.py
author Sune Foldager <cryo@cyanite.org>
Mon, 08 Sep 2008 12:55:46 +0200
changeset 7007 a6b74fbb5ce0
parent 6941 b2bc2d984bac
child 7049 6489ee64b522
permissions -rw-r--r--
fetch: added support for named branches Previously, fetch didn't really work when there were multiple named branches in the repository. Now it tries to do the right thing(tm) in all situations.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
# fetch.py - pull and merge remote changes
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
#
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     3
# Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     4
#
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     5
# This software may be used and distributed according to the terms
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     6
# of the GNU General Public License, incorporated herein by reference.
6666
53465a7464e2 convert comments to docstrings in a bunch of extensions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6385
diff changeset
     7
'''pulling, updating and merging in one command'''
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     8
3891
6b4127c7d52a Simplify i18n imports
Matt Mackall <mpm@selenic.com>
parents: 3877
diff changeset
     9
from mercurial.i18n import _
6211
f89fd07fc51d Expand import * to allow Pyflakes to find problems
Joel Rosdahl <joel@rosdahl.net>
parents: 6207
diff changeset
    10
from mercurial.node import nullid, short
6212
e75aab656f46 Remove unused imports
Joel Rosdahl <joel@rosdahl.net>
parents: 6211
diff changeset
    11
from mercurial import commands, cmdutil, hg, util
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    12
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
def fetch(ui, repo, source='default', **opts):
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    14
    '''Pull changes from a remote repository, merge new changes if needed.
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    15
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    16
    This finds all changes from the repository at the specified path
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    17
    or URL and adds them to the local repository.
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    18
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    19
    If the pulled changes add a new branch head, the head is automatically
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
    merged, and the result of the merge is committed.  Otherwise, the
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    21
    working directory is updated to include the new changes.
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    22
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    23
    When a merge occurs, the newly pulled changes are assumed to be
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    24
    "authoritative".  The head of the new changes is used as the first
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    25
    parent, with local changes as the second.  To switch the merge
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    26
    order, use --switch-parent.
6163
1f733c2f0165 Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6139
diff changeset
    27
1f733c2f0165 Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6139
diff changeset
    28
    See 'hg help dates' for a list of formats valid for -d/--date.
1f733c2f0165 Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6139
diff changeset
    29
    '''
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    30
6941
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    31
    date = opts.get('date')
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    32
    if date:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    33
        opts['date'] = util.parsedate(date)
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    34
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    35
    parent, p2 = repo.dirstate.parents()
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    36
    branch = repo[parent].branch()
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    37
    if parent != repo[branch].node():
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    38
        raise util.Abort(_('working dir not at branch tip '
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    39
                           '(use "hg update" to check out branch tip)'))
6941
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    40
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    41
    if p2 != nullid:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    42
        raise util.Abort(_('outstanding uncommitted merge'))
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    43
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    44
    wlock = lock = None
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    45
    try:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    46
        wlock = repo.wlock()
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    47
        lock = repo.lock()
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    48
        mod, add, rem, del_ = repo.status()[:4]
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    49
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    50
        if mod or add or rem:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    51
            raise util.Abort(_('outstanding uncommitted changes'))
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    52
        if del_:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    53
            raise util.Abort(_('working directory is missing some files'))
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    54
        if len(repo.branchheads(branch)) > 1:
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    55
            raise util.Abort(_('multiple heads in this branch '
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    56
                               '(use "hg heads ." and "hg merge" to merge)'))
6941
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    57
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    58
        cmdutil.setremoteconfig(ui, opts)
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    59
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    60
        other = hg.repository(ui, ui.expandpath(source))
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    61
        ui.status(_('pulling from %s\n') %
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    62
                  util.hidepassword(ui.expandpath(source)))
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    63
        revs = None
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    64
        if opts['rev']:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    65
            if not other.local():
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    66
                raise util.Abort(_("fetch -r doesn't work for remote "
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    67
                                   "repositories yet"))
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    68
            else:
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    69
                revs = [other.lookup(rev) for rev in opts['rev']]
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    70
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    71
        # Are there any changes at all?
6941
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    72
        modheads = repo.pull(other, heads=revs)
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    73
        if modheads == 0:
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    74
            return 0
6941
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
    75
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    76
        # Is this a simple fast-forward along the current branch?
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    77
        newheads = repo.branchheads(branch)
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    78
        newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    79
        if len(newheads) == 1:
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    80
            if newchildren[0] != parent:
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    81
                return hg.clean(repo, newchildren[0])
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    82
            else:
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    83
                return
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    84
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    85
        # Are there more than one additional branch heads?
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    86
        newchildren = [n for n in newchildren if n != parent]
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
        newparent = parent
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    88
        if newchildren:
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    89
            newparent = newchildren[0]
4917
126f527b3ba3 Make repo locks recursive, eliminate all passing of lock/wlock
Matt Mackall <mpm@selenic.com>
parents: 4915
diff changeset
    90
            hg.clean(repo, newparent)
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    91
        newheads = [n for n in newheads if n != newparent]
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    92
        if len(newheads) > 1:
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    93
            ui.status(_('not merging with %d other new branch heads '
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    94
                        '(use "hg heads ." and "hg merge" to merge them)\n') %
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    95
                      (len(newheads) - 1))
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    96
            return
7007
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    97
a6b74fbb5ce0 fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6941
diff changeset
    98
        # Otherwise, let's merge.
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
    99
        err = False
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   100
        if newheads:
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   101
            # By default, we consider the repository we're pulling
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   102
            # *from* as authoritative, so we merge our changes into
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   103
            # theirs.
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   104
            if opts['switch_parent']:
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   105
                firstparent, secondparent = newparent, newheads[0]
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   106
            else:
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   107
                firstparent, secondparent = newheads[0], newparent
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   108
                ui.status(_('updating to %d:%s\n') %
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   109
                          (repo.changelog.rev(firstparent),
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   110
                           short(firstparent)))
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   111
            hg.clean(repo, firstparent)
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   112
            ui.status(_('merging with %d:%s\n') %
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   113
                      (repo.changelog.rev(secondparent), short(secondparent)))
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   114
            err = hg.merge(repo, secondparent, remind=False)
6941
b2bc2d984bac fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6666
diff changeset
   115
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   116
        if not err:
4917
126f527b3ba3 Make repo locks recursive, eliminate all passing of lock/wlock
Matt Mackall <mpm@selenic.com>
parents: 4915
diff changeset
   117
            mod, add, rem = repo.status()[:3]
4549
0c61124ad877 dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents: 3891
diff changeset
   118
            message = (cmdutil.logmessage(opts) or
5798
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
   119
                       (_('Automated merge with %s') %
86f5d8f608b7 fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
   120
                        util.removeauth(other.url())))
6225
595a69a01129 fetch: rename --force-editor option to --edit, for consistency
Bryan O'Sullivan <bos@serpentine.com>
parents: 6212
diff changeset
   121
            force_editor = opts.get('force_editor') or opts.get('edit')
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   122
            n = repo.commit(mod + add + rem, message,
6385
0d4e068e9e52 commit: when committing the results of a merge, it's all or nothing
Bryan O'Sullivan <bos@serpentine.com>
parents: 6226
diff changeset
   123
                            opts['user'], opts['date'], force=True,
6225
595a69a01129 fetch: rename --force-editor option to --edit, for consistency
Bryan O'Sullivan <bos@serpentine.com>
parents: 6212
diff changeset
   124
                            force_editor=force_editor)
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   125
            ui.status(_('new changeset %d:%s merges remote changes '
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   126
                        'with local\n') % (repo.changelog.rev(n),
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   127
                                           short(n)))
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   128
2825
0496cfb05243 fetch: lock repo across pull and commit
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2824
diff changeset
   129
    finally:
4915
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4730
diff changeset
   130
        del lock, wlock
2800
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   131
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   132
cmdtable = {
135823f37304 new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   133
    'fetch':
4730
eadfaa9ec487 Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4549
diff changeset
   134
        (fetch,
5147
c80af96943aa refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4917
diff changeset
   135
        [('r', 'rev', [], _('a specific revision you would like to pull')),
6225
595a69a01129 fetch: rename --force-editor option to --edit, for consistency
Bryan O'Sullivan <bos@serpentine.com>
parents: 6212
diff changeset
   136
         ('e', 'edit', None, _('edit commit message')),
595a69a01129 fetch: rename --force-editor option to --edit, for consistency
Bryan O'Sullivan <bos@serpentine.com>
parents: 6212
diff changeset
   137
         ('', 'force-editor', None, _('edit commit message (DEPRECATED)')),
6206
0b6f12495276 fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents: 6163
diff changeset
   138
         ('', 'switch-parent', None, _('switch parents when merging')),
5147
c80af96943aa refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4917
diff changeset
   139
        ] + commands.commitopts + commands.commitopts2 + commands.remoteopts,
4730
eadfaa9ec487 Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4549
diff changeset
   140
        _('hg fetch [SOURCE]')),
eadfaa9ec487 Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4549
diff changeset
   141
}