author | Martin Geisler <mg@lazybytes.net> |
Sun, 26 Jul 2009 01:33:00 +0200 | |
changeset 9249 | 16f4cfc69e4f |
parent 9219 | 3f650f6aa130 |
child 9258 | 1aeb22492b25 |
permissions | -rw-r--r-- |
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 |
# |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8188
diff
changeset
|
5 |
# This software may be used and distributed according to the terms of the |
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8188
diff
changeset
|
6 |
# GNU General Public License version 2, incorporated herein by reference. |
8228
eee2319c5895
add blank line after copyright notices and after header
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
7 |
|
8894
868670dbc237
extensions: improve the consistency of synopses
Cédric Duval <cedricduval@free.fr>
parents:
8706
diff
changeset
|
8 |
'''pull, update and merge in one command''' |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
9 |
|
3891 | 10 |
from mercurial.i18n import _ |
6211
f89fd07fc51d
Expand import * to allow Pyflakes to find problems
Joel Rosdahl <joel@rosdahl.net>
parents:
6207
diff
changeset
|
11 |
from mercurial.node import nullid, short |
8532
b97e2417ae53
fetch: allow -r for remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8407
diff
changeset
|
12 |
from mercurial import commands, cmdutil, hg, util, url, error |
8112
6ee71f78497c
switch lock releasing in the extensions from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
7991
diff
changeset
|
13 |
from mercurial.lock import release |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
14 |
|
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 |
def fetch(ui, repo, source='default', **opts): |
7598 | 16 |
'''pull changes from a remote repository, merge new changes if needed. |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
17 |
|
9060
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
18 |
This finds all changes from the repository at the specified path or URL |
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
19 |
and adds them to the local repository. |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
20 |
|
9060
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
21 |
If the pulled changes add a new branch head, the head is automatically |
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
22 |
merged, and the result of the merge is committed. Otherwise, the working |
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
23 |
directory is updated to include the new changes. |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
24 |
|
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
25 |
When a merge occurs, the newly pulled changes are assumed to be |
9060
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
26 |
"authoritative". The head of the new changes is used as the first parent, |
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
27 |
with local changes as the second. To switch the merge order, use |
2555120b88f5
fetch: wrapped docstrings at 78 characters
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
28 |
--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
|
29 |
|
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6139
diff
changeset
|
30 |
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
|
31 |
''' |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
32 |
|
6941
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
33 |
date = opts.get('date') |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
34 |
if date: |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
35 |
opts['date'] = util.parsedate(date) |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
36 |
|
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
37 |
parent, p2 = repo.dirstate.parents() |
7049
6489ee64b522
fetch: use dirstate branch instead of first parents
Sune Foldager <cryo@cyanite.org>
parents:
7007
diff
changeset
|
38 |
branch = repo.dirstate.branch() |
6489ee64b522
fetch: use dirstate branch instead of first parents
Sune Foldager <cryo@cyanite.org>
parents:
7007
diff
changeset
|
39 |
branchnode = repo.branchtags().get(branch) |
6489ee64b522
fetch: use dirstate branch instead of first parents
Sune Foldager <cryo@cyanite.org>
parents:
7007
diff
changeset
|
40 |
if parent != branchnode: |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
41 |
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
|
42 |
'(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
|
43 |
|
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
44 |
if p2 != nullid: |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
45 |
raise util.Abort(_('outstanding uncommitted merge')) |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
46 |
|
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
47 |
wlock = lock = None |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
48 |
try: |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
49 |
wlock = repo.wlock() |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
50 |
lock = repo.lock() |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
51 |
mod, add, rem, del_ = repo.status()[:4] |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
52 |
|
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
53 |
if mod or add or rem: |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
54 |
raise util.Abort(_('outstanding uncommitted changes')) |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
55 |
if del_: |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
56 |
raise util.Abort(_('working directory is missing some files')) |
7854
423b4482c5cb
fetch: do not count inactive branches when inferring a merge
Benjamin Pollack <benjamin@bitquabit.com>
parents:
7598
diff
changeset
|
57 |
bheads = repo.branchheads(branch) |
423b4482c5cb
fetch: do not count inactive branches when inferring a merge
Benjamin Pollack <benjamin@bitquabit.com>
parents:
7598
diff
changeset
|
58 |
bheads = [head for head in bheads if len(repo[head].children()) == 0] |
423b4482c5cb
fetch: do not count inactive branches when inferring a merge
Benjamin Pollack <benjamin@bitquabit.com>
parents:
7598
diff
changeset
|
59 |
if len(bheads) > 1: |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
60 |
raise util.Abort(_('multiple heads in this branch ' |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
61 |
'(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
|
62 |
|
8188 | 63 |
other = hg.repository(cmdutil.remoteui(repo, opts), |
64 |
ui.expandpath(source)) |
|
6941
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
65 |
ui.status(_('pulling from %s\n') % |
7270
2db33c1a5654
factor out the url handling from httprepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7049
diff
changeset
|
66 |
url.hidepassword(ui.expandpath(source))) |
6941
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
67 |
revs = None |
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
68 |
if opts['rev']: |
8532
b97e2417ae53
fetch: allow -r for remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8407
diff
changeset
|
69 |
try: |
6941
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
70 |
revs = [other.lookup(rev) for rev in opts['rev']] |
8532
b97e2417ae53
fetch: allow -r for remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8407
diff
changeset
|
71 |
except error.CapabilityError: |
b97e2417ae53
fetch: allow -r for remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8407
diff
changeset
|
72 |
err = _("Other repository doesn't support revision lookup, " |
b97e2417ae53
fetch: allow -r for remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8407
diff
changeset
|
73 |
"so a rev cannot be specified.") |
b97e2417ae53
fetch: allow -r for remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8407
diff
changeset
|
74 |
raise util.Abort(err) |
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 |
# Are there any changes at all? |
6941
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
77 |
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
|
78 |
if modheads == 0: |
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
79 |
return 0 |
6941
b2bc2d984bac
fetch: linearize code by eliminating nested functions
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6666
diff
changeset
|
80 |
|
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
81 |
# 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
|
82 |
newheads = repo.branchheads(branch) |
7854
423b4482c5cb
fetch: do not count inactive branches when inferring a merge
Benjamin Pollack <benjamin@bitquabit.com>
parents:
7598
diff
changeset
|
83 |
newheads = [head for head in newheads if len(repo[head].children()) == 0] |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
84 |
newchildren = repo.changelog.nodesbetween([parent], newheads)[2] |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
85 |
if len(newheads) == 1: |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
86 |
if newchildren[0] != parent: |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
87 |
return hg.clean(repo, newchildren[0]) |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
88 |
else: |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
89 |
return |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
90 |
|
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
91 |
# Are there more than one additional branch heads? |
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
92 |
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
|
93 |
newparent = parent |
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
94 |
if newchildren: |
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
95 |
newparent = newchildren[0] |
4917
126f527b3ba3
Make repo locks recursive, eliminate all passing of lock/wlock
Matt Mackall <mpm@selenic.com>
parents:
4915
diff
changeset
|
96 |
hg.clean(repo, newparent) |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
97 |
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
|
98 |
if len(newheads) > 1: |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
99 |
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
|
100 |
'(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
|
101 |
(len(newheads) - 1)) |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
102 |
return |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
103 |
|
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6941
diff
changeset
|
104 |
# 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
|
105 |
err = False |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
106 |
if newheads: |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
107 |
# 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
|
108 |
# *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
|
109 |
# theirs. |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
110 |
if opts['switch_parent']: |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
111 |
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
|
112 |
else: |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
113 |
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
|
114 |
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
|
115 |
(repo.changelog.rev(firstparent), |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
116 |
short(firstparent))) |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
117 |
hg.clean(repo, firstparent) |
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
118 |
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
|
119 |
(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
|
120 |
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
|
121 |
|
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
122 |
if not err: |
9183
d0225fa2f6c4
do not translate commit messages
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
123 |
# we don't translate commit messages |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
3891
diff
changeset
|
124 |
message = (cmdutil.logmessage(opts) or |
9183
d0225fa2f6c4
do not translate commit messages
Martin Geisler <mg@lazybytes.net>
parents:
8894
diff
changeset
|
125 |
('Automated merge with %s' % |
7270
2db33c1a5654
factor out the url handling from httprepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7049
diff
changeset
|
126 |
url.removeauth(other.url()))) |
8407
223000a687b0
commit: move commit editor to cmdutil, pass as function
Matt Mackall <mpm@selenic.com>
parents:
8228
diff
changeset
|
127 |
editor = cmdutil.commiteditor |
223000a687b0
commit: move commit editor to cmdutil, pass as function
Matt Mackall <mpm@selenic.com>
parents:
8228
diff
changeset
|
128 |
if opts.get('force_editor') or opts.get('edit'): |
223000a687b0
commit: move commit editor to cmdutil, pass as function
Matt Mackall <mpm@selenic.com>
parents:
8228
diff
changeset
|
129 |
editor = cmdutil.commitforceeditor |
9185
d9a2e6327949
fetch: drop force arg for commit (issue1752)
Matt Mackall <mpm@selenic.com>
parents:
8894
diff
changeset
|
130 |
n = repo.commit(message, opts['user'], opts['date'], editor=editor) |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
131 |
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
|
132 |
'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
|
133 |
short(n))) |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
6163
diff
changeset
|
134 |
|
2825
0496cfb05243
fetch: lock repo across pull and commit
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2824
diff
changeset
|
135 |
finally: |
8112
6ee71f78497c
switch lock releasing in the extensions from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
7991
diff
changeset
|
136 |
release(lock, wlock) |
2800
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
137 |
|
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
138 |
cmdtable = { |
135823f37304
new extension: fetch -> combine pull and merge/update
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
139 |
'fetch': |
4730
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4549
diff
changeset
|
140 |
(fetch, |
5147
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4917
diff
changeset
|
141 |
[('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
|
142 |
('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
|
143 |
('', '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
|
144 |
('', 'switch-parent', None, _('switch parents when merging')), |
5147
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4917
diff
changeset
|
145 |
] + 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
|
146 |
_('hg fetch [SOURCE]')), |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4549
diff
changeset
|
147 |
} |