commit: when committing the results of a merge, it's all or nothing
Previously, it was possible to commit just one file from a merge, which
is essentially always the wrong thing to do. This fixes issue 1049.
--- a/hgext/fetch.py Mon Mar 24 22:49:33 2008 +0100
+++ b/hgext/fetch.py Mon Mar 24 15:36:56 2008 -0700
@@ -67,7 +67,7 @@
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'],
+ opts['user'], opts['date'], force=True,
force_editor=force_editor)
ui.status(_('new changeset %d:%s merges remote changes '
'with local\n') % (repo.changelog.rev(n),
--- a/mercurial/commands.py Mon Mar 24 22:49:33 2008 +0100
+++ b/mercurial/commands.py Mon Mar 24 15:36:56 2008 -0700
@@ -539,6 +539,9 @@
If a list of files is omitted, all changes reported by "hg status"
will be committed.
+ If you are committing the result of a merge, do not provide any
+ file names or -I/-X filters.
+
If no commit message is specified, the configured editor is started to
enter a message.
--- a/mercurial/localrepo.py Mon Mar 24 22:49:33 2008 +0100
+++ b/mercurial/localrepo.py Mon Mar 24 15:36:56 2008 -0700
@@ -781,6 +781,11 @@
if use_dirstate:
p1, p2 = self.dirstate.parents()
update_dirstate = True
+
+ if (not force and p2 != nullid and
+ (files or match != util.always)):
+ raise util.Abort(_('cannot partially commit a merge '
+ '(do not specify files or patterns)'))
else:
p1, p2 = p1, p2 or nullid
update_dirstate = (self.dirstate.parents()[0] == p1)
--- a/tests/test-glog Mon Mar 24 22:49:33 2008 +0100
+++ b/tests/test-glog Mon Mar 24 15:36:56 2008 -0700
@@ -82,7 +82,7 @@
fi
echo $rev > $rev
hg add $rev
- hg ci -d "$rev 0" -m "($rev) $msg" $rev
+ hg rawcommit -q -d "$rev 0" -m "($rev) $msg" $rev
}
echo "[extensions]" >> $HGRCPATH
--- a/tests/test-glog.out Mon Mar 24 22:49:33 2008 +0100
+++ b/tests/test-glog.out Mon Mar 24 15:36:56 2008 -0700
@@ -1,11 +1,41 @@
% init
% empty repo
% building tree
-created new head
-created new head
-created new head
-created new head
-created new head
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
+(the rawcommit command is deprecated)
% glog -q
@ 34:0eed7cd895e0
|
--- a/tests/test-parentrevspec Mon Mar 24 22:49:33 2008 +0100
+++ b/tests/test-parentrevspec Mon Mar 24 15:36:56 2008 -0700
@@ -16,7 +16,7 @@
echo >> foo
- hg commit -d '0 0' -qAm "$msg" foo
+ hg commit -d '0 0' -qAm "$msg"
}
hg init repo