[PATCH 2 of 3] localrepo: put bookmark move following commit in one transaction
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Nov 18 04:02:19 CST 2015
On 11/17/2015 01:05 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1447793286 28800
> # Tue Nov 17 12:48:06 2015 -0800
> # Node ID 81aacd9541c1a516a7eff1fa03e5a24bd5e64b6f
> # Parent 01e537eafc7d1c7d582a29b8add833e0e6cf3d4b
> localrepo: put bookmark move following commit in one transaction
>
> Before this patch, making a commit on a local repo could move a bookmark and
> both operations would not be grouped as one transaction. This patch makes both
> operations part of one transaction. This is necessary to switch to the new api
> to save bookmarks repo._bookmarks.recordchange if we don't want to change the
> current behavior of rollback.
>
> Dirstate change happening after the commit is done is now part of the
> transaction mentioned above. This leads to a change in the expected output of
> several tests.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1592,22 +1592,28 @@
> subrepo.writestate(self, newstate)
>
> p1, p2 = self.dirstate.parents()
> - if True:
> + lock = tr = None
> + try:
> + lock = self.lock()
> hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
> try:
> self.hook("precommit", throw=True, parent1=hookp1,
> parent2=hookp2)
> + tr = self.transaction('commit')
> ret = self.commitctx(cctx, True)
> except: # re-raises
> if edited:
> self.ui.write(
> _('note: commit message saved in %s\n') % msgfn)
> raise
> -
> # update bookmarks, dirstate and mergestate
> bookmarks.update(self, [p1, p2], ret)
> cctx.markcommitted(ret)
> ms.reset()
> + tr.close()
> + finally:
> + lockmod.release(lock, tr)
> +
> finally:
> wlock.release()
I've unified the two release, dropped the indent change and merged patch
1 and 2. I pushed the result to the clowncopter.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list