--- a/hgext/fetch.py Mon Mar 10 02:54:37 2008 -0500
+++ b/hgext/fetch.py Tue Mar 11 17:42:26 2008 -0500
@@ -65,9 +65,10 @@
message = (cmdutil.logmessage(opts) or
(_('Automated merge with %s') %
util.removeauth(other.url())))
+ force_editor = opts.get('force_editor') or opts.get('edit')
n = repo.commit(mod + add + rem, message,
opts['user'], opts['date'],
- force_editor=opts.get('force_editor'))
+ force_editor=force_editor)
ui.status(_('new changeset %d:%s merges remote changes '
'with local\n') % (repo.changelog.rev(n),
short(n)))
@@ -102,9 +103,11 @@
try:
wlock = repo.wlock()
lock = repo.lock()
- mod, add, rem = repo.status()[:3]
+ mod, add, rem, del_ = repo.status()[:4]
if mod or add or rem:
raise util.Abort(_('outstanding uncommitted changes'))
+ if del_:
+ raise util.Abort(_('working directory is missing some files'))
if len(repo.heads()) > 1:
raise util.Abort(_('multiple heads in this repository '
'(use "hg heads" and "hg merge" to merge)'))
@@ -116,7 +119,8 @@
'fetch':
(fetch,
[('r', 'rev', [], _('a specific revision you would like to pull')),
- ('f', 'force-editor', None, _('edit commit message')),
+ ('e', 'edit', None, _('edit commit message')),
+ ('', 'force-editor', None, _('edit commit message (DEPRECATED)')),
('', 'switch-parent', None, _('switch parents when merging')),
] + commands.commitopts + commands.commitopts2 + commands.remoteopts,
_('hg fetch [SOURCE]')),
--- a/tests/test-fetch Mon Mar 10 02:54:37 2008 -0500
+++ b/tests/test-fetch Tue Mar 11 17:42:26 2008 -0500
@@ -52,5 +52,12 @@
echo g > g/g
hg --cwd g ci -d '6 0' -Amg
+hg clone -q f h
+hg clone -q g i
+
echo % should merge f into g
hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f
+
+rm i/g
+echo % should abort, because i is modified
+hg --cwd i fetch ../h
--- a/tests/test-fetch.out Mon Mar 10 02:54:37 2008 -0500
+++ b/tests/test-fetch.out Tue Mar 11 17:42:26 2008 -0500
@@ -71,3 +71,5 @@
merging with 3:cc6a3744834d
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
new changeset 4:55aa4f32ec59 merges remote changes with local
+% should abort, because i is modified
+abort: working directory is missing some files