[issue835] qpush leaves new files empty when earlier file to modify is missing

Peter Arrenbrecht mercurial-bugs at selenic.com
Tue Nov 20 02:52:54 CST 2007


New submission from Peter Arrenbrecht <peter.arrenbrecht at gmail.com>:

Try:

	hg init a
	cd a
	hg qinit
	echo one >one
	hg add
	hg ci -m "one"

	# Create patch modifying "one" and adding "two".
	hg qnew two.patch
	echo two >two
	echo more >>one
	hg add
	hg qref

	# Pop the patch, remove "one", then repush the patch.
	hg qpop
	hg rm one
	hg ci -m "-one"
	hg qpush -v

The output of "qpush" is:

	applying two.patch
	unable to find one or one for patching
	adding qpush-test/two
	two
	Errors during apply, please fix and refresh two.patch
	qpush-test/one: No such file or directory
	one not tracked!
	patch failed, rejects left in working dir

"two" is now empty, but the message suggests I just need to fix the problem with
"one" and then refresh. Since "one" is gone, I'll just ignore it and qrefresh.
Now I lose the contents of "two" *in the patch*.

A reasonable approach might be to make patch.applydiff catch PatchErrors and
continue with the next file. If this is not an option, then at least "two"
should not get added (with misleading success messages) and it should not get
created. It does get created right now after the patch failed by patch.updatedir at:

	if ctype == 'ADD' and not os.path.exists(dst):
		repo.wwrite(gp.path, '', x and 'x' or '')

----------
messages: 4344
nosy: parren
priority: urgent
status: unread
title: qpush leaves new files empty when earlier file to modify is missing

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue835>
____________________________________________________



More information about the Mercurial-devel mailing list