Patchwork [2,of,8,V5] bundleoperation: add applybookmarks flag

login
register
mail settings
Submitter Stanislau Hlebik
Date Sept. 16, 2016, 11:10 a.m.
Message ID <f3fb030f0e4601561ac9.1474024230@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/16640/
State Accepted
Headers show

Comments

Stanislau Hlebik - Sept. 16, 2016, 11:10 a.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1473951984 25200
#      Thu Sep 15 08:06:24 2016 -0700
# Node ID f3fb030f0e4601561ac94137c7481694407db7b7
# Parent  b25504471680d6d14f3096997760bc3acd76089d
bundleoperation: add applybookmarks flag

This flag will be used by `bookmarks` part handler.
If it is false then handler will make no changes to the repo and just add
bookmarks to the `op.records`.
If it is true then handler will change the repo bookmarks.
Pierre-Yves David - Sept. 16, 2016, 3:53 p.m.
On 09/16/2016 01:10 PM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash@fb.com>
> # Date 1473951984 25200
> #      Thu Sep 15 08:06:24 2016 -0700
> # Node ID f3fb030f0e4601561ac94137c7481694407db7b7
> # Parent  b25504471680d6d14f3096997760bc3acd76089d
> bundleoperation: add applybookmarks flag
>
> This flag will be used by `bookmarks` part handler.
> If it is false then handler will make no changes to the repo and just add
> bookmarks to the `op.records`.
> If it is true then handler will change the repo bookmarks.

If I remember our tuesday discussion properly, we actually need at least 
three state here:
- Read only data fetch
- apply with divergent bookmark
- apply overwriting local value

Picking a boolean will not allow that. What is your plan here?

> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -286,13 +286,15 @@
>      * a way to construct a bundle response when applicable.
>      """
>
> -    def __init__(self, repo, transactiongetter, captureoutput=True):
> +    def __init__(self, repo, transactiongetter, captureoutput=True,
> +                 applybookmarks=False):
>          self.repo = repo
>          self.ui = repo.ui
>          self.records = unbundlerecords()
>          self.gettransaction = transactiongetter
>          self.reply = None
>          self.captureoutput = captureoutput
> +        self.applybookmarks = applybookmarks
>
>  class TransactionUnavailable(RuntimeError):
>      pass
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -286,13 +286,15 @@ 
     * a way to construct a bundle response when applicable.
     """
 
-    def __init__(self, repo, transactiongetter, captureoutput=True):
+    def __init__(self, repo, transactiongetter, captureoutput=True,
+                 applybookmarks=False):
         self.repo = repo
         self.ui = repo.ui
         self.records = unbundlerecords()
         self.gettransaction = transactiongetter
         self.reply = None
         self.captureoutput = captureoutput
+        self.applybookmarks = applybookmarks
 
 class TransactionUnavailable(RuntimeError):
     pass