[PATCH] mq: update bookmarks during qrefresh

Pierre-Yves David pierre-yves.david at logilab.fr
Mon Oct 1 05:39:45 CDT 2012


On Mon, Oct 01, 2012 at 03:45:13AM +0200, David Soria Parra wrote:
> # HG changeset patch
> # User David Soria Parra <dsp at php.net>
> # Date 1349052286 -7200
> # Node ID be779d3b1d31679260b166a76818d34847742214
> # Parent  6d7db5794e8cad7da042b6ae6238116c6e59a4d2
> mq: update bookmarks during qrefresh
> 
> Bookmarks are updated during qpop and qpush, but they are not updated
> during qrefresh. This behaviour makes it hard to work on an evolving
> changeset at the head of a branch. qrefresh should update all bookmarks
> that point to the refreshed commit with the new nodeid.
> 
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -63,7 +63,7 @@
>  from mercurial.node import bin, hex, short, nullid, nullrev
>  from mercurial.lock import release
>  from mercurial import commands, cmdutil, hg, scmutil, util, revset
> -from mercurial import repair, extensions, url, error, phases
> +from mercurial import repair, extensions, url, error, phases, bookmarks
>  from mercurial import patch as patchmod
>  import os, re, errno, shutil
>  
> @@ -1577,6 +1577,7 @@
>              a = list(aa)
>              c = [filter(matchfn, l) for l in (m, a, r)]
>              match = scmutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs))
> +            bmlist = [bm for bm in repo._bookmarks if repo[bm] == repo[top]]

why not using repo[top].bookmarks() ?

>              try:
>                  if diffopts.git or diffopts.upgrade:
> @@ -1662,6 +1663,11 @@
>                  for chunk in chunks:
>                      patchf.write(chunk)
>                  patchf.close()
> +
> +                for bm in bmlist:
> +                    repo._bookmarks[bm] = repo.changectx('.').node()
> +                bookmarks.write(repo)
> +
>                  self.applied.append(statusentry(n, patchfn))
>              except: # re-raises
>                  ctx = repo[cparents[0]]

Can't we get the call to repo.changectx('.').node() out of the loop ?

-- 
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/20121001/8a015063/attachment.pgp>


More information about the Mercurial-devel mailing list