Quantcast

[PATCH] bookmarks: fix HG_PENDING handling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] bookmarks: fix HG_PENDING handling

timeless-4
# HG changeset patch
# User timeless <[hidden email]>
# Date 1487089111 0
#      Tue Feb 14 16:18:31 2017 +0000
# Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
# Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
# Available At https://bitbucket.org/timeless/mercurial-crew
#              hg pull https://bitbucket.org/timeless/mercurial-crew -r 54804162d8b3
bookmarks: fix HG_PENDING handling

HG_PENDING is supposed to point to a specific repo when
called as part of a hook, without this, any command in an
unrelated repository would read the pending version of
bookmark state instead of the version that is appropriate.

diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
--- a/mercurial/bookmarks.py Tue Feb 14 01:52:16 2017 +0530
+++ b/mercurial/bookmarks.py Tue Feb 14 16:18:31 2017 +0000
@@ -30,7 +30,7 @@
     may need to tweak this behavior further.
     """
     bkfile = None
-    if 'HG_PENDING' in encoding.environ:
+    if encoding.environ.get('HG_PENDING') == repo.root:
         try:
             bkfile = repo.vfs('bookmarks.pending')
         except IOError as inst:
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] bookmarks: fix HG_PENDING handling

Augie Fackler-2
foozy, how does this (and timeless' other patch in the same basic
area) relate to the patches you said you've got coming?

Thanks!
Augie

On Tue, Feb 14, 2017 at 04:19:45PM +0000, timeless wrote:

> # HG changeset patch
> # User timeless <[hidden email]>
> # Date 1487089111 0
> #      Tue Feb 14 16:18:31 2017 +0000
> # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> # Available At https://bitbucket.org/timeless/mercurial-crew
> #              hg pull https://bitbucket.org/timeless/mercurial-crew -r 54804162d8b3
> bookmarks: fix HG_PENDING handling
>
> HG_PENDING is supposed to point to a specific repo when
> called as part of a hook, without this, any command in an
> unrelated repository would read the pending version of
> bookmark state instead of the version that is appropriate.
>
> diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py Tue Feb 14 01:52:16 2017 +0530
> +++ b/mercurial/bookmarks.py Tue Feb 14 16:18:31 2017 +0000
> @@ -30,7 +30,7 @@
>      may need to tweak this behavior further.
>      """
>      bkfile = None
> -    if 'HG_PENDING' in encoding.environ:
> +    if encoding.environ.get('HG_PENDING') == repo.root:
>          try:
>              bkfile = repo.vfs('bookmarks.pending')
>          except IOError as inst:
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] bookmarks: fix HG_PENDING handling

FUJIWARA Katsunori-2
At Wed, 15 Feb 2017 21:33:20 -0500,
Augie Fackler wrote:
>
> foozy, how does this (and timeless' other patch in the same basic
> area) relate to the patches you said you've got coming?

(sorry for late response)

This series (for bookmarks.py and localrepo.py) LGTM as the first step
of fixing HG_PENDING issues.

I can revise my pending patches for them easily.

> Thanks!
> Augie
>
> On Tue, Feb 14, 2017 at 04:19:45PM +0000, timeless wrote:
> > # HG changeset patch
> > # User timeless <[hidden email]>
> > # Date 1487089111 0
> > #      Tue Feb 14 16:18:31 2017 +0000
> > # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> > # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> > # Available At https://bitbucket.org/timeless/mercurial-crew
> > #              hg pull https://bitbucket.org/timeless/mercurial-crew -r 54804162d8b3
> > bookmarks: fix HG_PENDING handling
> >
> > HG_PENDING is supposed to point to a specific repo when
> > called as part of a hook, without this, any command in an
> > unrelated repository would read the pending version of
> > bookmark state instead of the version that is appropriate.
> >
> > diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> > --- a/mercurial/bookmarks.py Tue Feb 14 01:52:16 2017 +0530
> > +++ b/mercurial/bookmarks.py Tue Feb 14 16:18:31 2017 +0000
> > @@ -30,7 +30,7 @@
> >      may need to tweak this behavior further.
> >      """
> >      bkfile = None
> > -    if 'HG_PENDING' in encoding.environ:
> > +    if encoding.environ.get('HG_PENDING') == repo.root:
> >          try:
> >              bkfile = repo.vfs('bookmarks.pending')
> >          except IOError as inst:
> > _______________________________________________
> > Mercurial-devel mailing list
> > [hidden email]
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

--
----------------------------------------------------------------------
[FUJIWARA Katsunori]                             [hidden email]
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] bookmarks: fix HG_PENDING handling

FUJIWARA Katsunori-2
At Mon, 20 Feb 2017 03:57:54 +0900,
FUJIWARA Katsunori wrote:

>
> At Wed, 15 Feb 2017 21:33:20 -0500,
> Augie Fackler wrote:
> >
> > foozy, how does this (and timeless' other patch in the same basic
> > area) relate to the patches you said you've got coming?
>
> (sorry for late response)
>
> This series (for bookmarks.py and localrepo.py) LGTM as the first step
> of fixing HG_PENDING issues.

(I discard this reply according to recent confirmation with wrong
condition. I had to believe my pending works :-<)

This patch works as expected, only if bookmarks aren't shared by share
extension.

Enabling share extension (+ bookmark sharing) makes
bookmarks._getbkfile() receive repo to be shared (= 'srcrepo') as
'repo'. On the other hand, HG_PENDING always refers current working
repository (= 'currepo') enabling share extension.

Therefore, pending changes in srcrepo are never visible to an external
hook spawned by currepo.

This patch should imply changes for share.py, IMHO.

Unfortunately, bookmarks._getbkfile() uses received 'repo' not only
for getting 'root' but also getting 'vfs'. To fix original issue
safely, we should:

  - make bookmarks._getbkfile() receive 'root' and 'vfs' separately, or
  - execute HG_PENDING logic locally in share.getbkfile()


> I can revise my pending patches for them easily.
>
> > Thanks!
> > Augie
> >
> > On Tue, Feb 14, 2017 at 04:19:45PM +0000, timeless wrote:
> > > # HG changeset patch
> > > # User timeless <[hidden email]>
> > > # Date 1487089111 0
> > > #      Tue Feb 14 16:18:31 2017 +0000
> > > # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> > > # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> > > # Available At https://bitbucket.org/timeless/mercurial-crew
> > > #              hg pull https://bitbucket.org/timeless/mercurial-crew -r 54804162d8b3
> > > bookmarks: fix HG_PENDING handling
> > >
> > > HG_PENDING is supposed to point to a specific repo when
> > > called as part of a hook, without this, any command in an
> > > unrelated repository would read the pending version of
> > > bookmark state instead of the version that is appropriate.
> > >
> > > diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> > > --- a/mercurial/bookmarks.py Tue Feb 14 01:52:16 2017 +0530
> > > +++ b/mercurial/bookmarks.py Tue Feb 14 16:18:31 2017 +0000
> > > @@ -30,7 +30,7 @@
> > >      may need to tweak this behavior further.
> > >      """
> > >      bkfile = None
> > > -    if 'HG_PENDING' in encoding.environ:
> > > +    if encoding.environ.get('HG_PENDING') == repo.root:
> > >          try:
> > >              bkfile = repo.vfs('bookmarks.pending')
> > >          except IOError as inst:
> > > _______________________________________________
> > > Mercurial-devel mailing list
> > > [hidden email]
> > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> >
>
> --
> ----------------------------------------------------------------------
> [FUJIWARA Katsunori]                             [hidden email]
>

--
----------------------------------------------------------------------
[FUJIWARA Katsunori]                             [hidden email]
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] bookmarks: fix HG_PENDING handling

FUJIWARA Katsunori-2
At Mon, 20 Feb 2017 06:11:30 +0900,
FUJIWARA Katsunori wrote:

>
> At Mon, 20 Feb 2017 03:57:54 +0900,
> FUJIWARA Katsunori wrote:
> >
> > At Wed, 15 Feb 2017 21:33:20 -0500,
> > Augie Fackler wrote:
> > >
> > > foozy, how does this (and timeless' other patch in the same basic
> > > area) relate to the patches you said you've got coming?
> >
> > (sorry for late response)
> >
> > This series (for bookmarks.py and localrepo.py) LGTM as the first step
> > of fixing HG_PENDING issues.
>
> (I discard this reply according to recent confirmation with wrong
> condition. I had to believe my pending works :-<)
>
> This patch works as expected, only if bookmarks aren't shared by share
> extension.
>
> Enabling share extension (+ bookmark sharing) makes
> bookmarks._getbkfile() receive repo to be shared (= 'srcrepo') as
> 'repo'. On the other hand, HG_PENDING always refers current working
> repository (= 'currepo') enabling share extension.
>
> Therefore, pending changes in srcrepo are never visible to an external
> hook spawned by currepo.
>
> This patch should imply changes for share.py, IMHO.
>
> Unfortunately, bookmarks._getbkfile() uses received 'repo' not only
> for getting 'root' but also getting 'vfs'. To fix original issue
> safely, we should:
>
>   - make bookmarks._getbkfile() receive 'root' and 'vfs' separately, or
>   - execute HG_PENDING logic locally in share.getbkfile()

Even after fixing above, pending changes of bookmarks is still
invisible in srcrepo to an external hook (with HG_PENDING, spawned in
currepo), because writing bookmarks.pending into srcrepo is executed
via "postclose" transaction hook.

If we should make currepo and srcrepo equal (except for "active
bookmark") for an external hook, more hacks are needed.

I remember that problem described in pages below led me to postpone
posting my patches :-)

  https://www.mercurial-scm.org/wiki/SharedRepository
  https://bz.mercurial-scm.org/show_bug.cgi?id=4858


>
> > I can revise my pending patches for them easily.
> >
> > > Thanks!
> > > Augie
> > >
> > > On Tue, Feb 14, 2017 at 04:19:45PM +0000, timeless wrote:
> > > > # HG changeset patch
> > > > # User timeless <[hidden email]>
> > > > # Date 1487089111 0
> > > > #      Tue Feb 14 16:18:31 2017 +0000
> > > > # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> > > > # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> > > > # Available At https://bitbucket.org/timeless/mercurial-crew
> > > > #              hg pull https://bitbucket.org/timeless/mercurial-crew -r 54804162d8b3
> > > > bookmarks: fix HG_PENDING handling
> > > >
> > > > HG_PENDING is supposed to point to a specific repo when
> > > > called as part of a hook, without this, any command in an
> > > > unrelated repository would read the pending version of
> > > > bookmark state instead of the version that is appropriate.
> > > >
> > > > diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> > > > --- a/mercurial/bookmarks.py Tue Feb 14 01:52:16 2017 +0530
> > > > +++ b/mercurial/bookmarks.py Tue Feb 14 16:18:31 2017 +0000
> > > > @@ -30,7 +30,7 @@
> > > >      may need to tweak this behavior further.
> > > >      """
> > > >      bkfile = None
> > > > -    if 'HG_PENDING' in encoding.environ:
> > > > +    if encoding.environ.get('HG_PENDING') == repo.root:
> > > >          try:
> > > >              bkfile = repo.vfs('bookmarks.pending')
> > > >          except IOError as inst:
> > > > _______________________________________________
> > > > Mercurial-devel mailing list
> > > > [hidden email]
> > > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> > >
> >
> > --
> > ----------------------------------------------------------------------
> > [FUJIWARA Katsunori]                             [hidden email]
> >
>
> --
> ----------------------------------------------------------------------
> [FUJIWARA Katsunori]                             [hidden email]
>

--
----------------------------------------------------------------------
[FUJIWARA Katsunori]                             [hidden email]
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] bookmarks: fix HG_PENDING handling

timeless
fwiw, I really don't have the resources to push either of these forward.

I was just trying to call attention to the problem.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Loading...