import --no-commit and rollback
Pierre-Yves David
pierre-yves.david at logilab.fr
Tue Mar 20 04:20:19 CDT 2012
On Tue, Mar 20, 2012 at 08:50:34AM +0100, Andreas Bernauer wrote:
> On 3/17/12 3:27, Greg Ward wrote:
> > [moving to mercurial-devel]
> >
> > On 16 March 2012, Andreas Bernauer said:
> >> On 3/16/12 3:08, Roman Neuhauser wrote:
> >>> hello,
> >>>
> >>> i wouldn't expect import --no-commit to be considered rollback-worthy.
> >>> is looks like a bug. the script is attached.
> >>
> >>
> >> I wouldn't expect that, either. This patch against 594fc9329628 may fix it:
> >>
> >> diff --git a/mercurial/commands.py b/mercurial/commands.py
> >> --- a/mercurial/commands.py
> >> +++ b/mercurial/commands.py
> >> @@ -3598,7 +3598,10 @@
> >> try:
> >> wlock = repo.wlock()
> >> lock = repo.lock()
> >> - tr = repo.transaction('import')
> >> + if opts.get('no_commit'):
> >> + tr = None
> >> + else:
> >> + tr = repo.transaction('import')
> >
> > Yuck: that duplicates the "if nocommit" case in widely separated
> > places, and makes the code even more deeply nested than it already is.
> >
>
> Yes. Another approach would be to have transaction not storing empty
> transactions. Is that feasible?
Meh, transaction also save content of .hg/store/ as bookmark or phase data
making this concept of "empty transaction" dangerous. We better ensure the
caller does not summon transaction logic for nuts.
--
Pierre-Yves David
http://www.logilab.fr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120320/15dd0db6/attachment.pgp>
More information about the Mercurial-devel
mailing list