D2875: remotenames: introduce a config option to allow creation of remote bookmarks

2020-04-22 Thread marmoute (Pierre-Yves David)
Herald added a subscriber: mercurial-patches.
This revision now requires changes to proceed.
marmoute added a comment.
marmoute requested changes to this revision.


  Baymax does not catch stuff in `Accepted` state, but this diff is over 2 
years old, so resubmit if still relevant.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D2875/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D2875

To: pulkit, #hg-reviewers, indygreg, marmoute
Cc: marmoute, mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2875: remotenames: introduce a config option to allow creation of remote bookmarks

2018-03-26 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 7288.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2875?vs=7251=7288

REVISION DETAIL
  https://phab.mercurial-scm.org/D2875

AFFECTED FILES
  hgext/remotenames.py
  tests/test-logexchange.t

CHANGE DETAILS

diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t
--- a/tests/test-logexchange.t
+++ b/tests/test-logexchange.t
@@ -523,7 +523,60 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: Added a
   
+Testing the remotenames.createbookmark config option
 
+  $ hg bookmarks -R ../server2/
+ $TESTTMP/server/bar 6:87d6d6676308
+ $TESTTMP/server/foo 3:62615734edd5
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+
+  $ hg push ../server2/ -B nonexistant
+  pushing to ../server2/
+  searching for changes
+  abort: bookmark 'nonexistant' does not exists on remote
+  [255]
+
+  $ hg push ../server2/ -r . -B nonexistant --config 
remotenames.createremotebookmark=True
+  pushing to ../server2/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  exporting bookmark nonexistant
+
+  $ hg bookmarks -R ../server2/
+ $TESTTMP/server/bar 6:87d6d6676308
+ $TESTTMP/server/foo 3:62615734edd5
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+ nonexistant   9:aa6a885086c0
+
+  $ hg log -R ../server2/ -r tip
+  changeset:   9:aa6a885086c0
+  branch:  wat
+  bookmark:nonexistant
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: added foobar
+  
+Check synchornising of remotenames after push
+
+  $ hg log -G -r .
+  @  changeset:   9:aa6a885086c0
+  |  branch:  wat
+  ~  tag: tip
+ remote bookmark:  $TESTTMP/server2/nonexistant
+ remote bookmark:  default/foo
+ hoisted name:  foo
+ remote branch:  $TESTTMP/server2/wat
+ remote branch:  default/wat
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: added foobar
+  
 More testing of remotenames.pushtobookmark config option
 -
 
@@ -625,3 +678,107 @@
   |/   ()
   o  0:f7ad41964313  added a
  ()
+
+Testing createbookmark when pushing multiple heads
+
+  $ echo zoo > zoo
+  $ hg ci -Aqm "added zoo"
+  $ hg up 4
+  2 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg ci -Aqm "added d"
+  $ hg glog
+  @  7:42dc4f6117ef  added d
+  |  ()
+  | o  6:07ea181fe329  added zoo
+  | |  ()
+  | o  5:e8d0567f11cf  added z
+  | |  ()
+  o |  4:8be98ac1a569  added c
+  | |  ()
+  | o  3:dc7d5acf2389  added y
+  | |  ()
+  | o  2:fa7447a9d391  added x
+  | |  (bm1)
+  o |  1:80e6d2c47cfe  added b
+  |/   ()
+  o  0:f7ad41964313  added a
+ ()
+  $ echo '[remotenames]' >> .hg/hgrc
+  $ echo 'createremotebookmark = True' >> .hg/hgrc
+
+pushing multiple heads leads to default behavior
+  $ hg push -B newbm -r 7 -r 6 ../server
+  pushing to ../server
+  searching for changes
+  bookmark newbm does not exist on the local or remote repository!
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  [2]
+
+bookmark is not pushed to the server
+  $ hg glog -R ../server
+  o  7:42dc4f6117ef  added d
+  |  ()
+  | o  6:07ea181fe329  added zoo
+  | |  ()
+  | o  5:e8d0567f11cf  added z
+  | |  (bm1)
+  | o  4:dc7d5acf2389  added y
+  | |  ()
+  o |  3:8be98ac1a569  added c
+  | |  ()
+  | @  2:fa7447a9d391  added x
+  | |  ()
+  o |  1:80e6d2c47cfe  added b
+  |/   ()
+  o  0:f7ad41964313  added a
+ ()
+
+Pushing multiple revs by specifying multiple -r but only one head
+
+  $ for ch in e f; do echo foo > $ch; hg ci -Aqm "added "$ch; done;
+
+  $ hg glog -r 7::
+  @  9:77bb50a270c5  added f
+  |  ()
+  o  8:f48de4b3d95a  added e
+  |  ()
+  o  7:42dc4f6117ef  added d
+  |  ()
+  ~
+
+  $ hg push -r 8 -r 9 -B newbm ../server
+  pushing to ../server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  exporting bookmark newbm
+
+bookmark is on the hedmost rev of revs which were pushed
+
+  $ hg glog -R ../server
+  o  9:77bb50a270c5  added f
+  |  (newbm)
+  o  8:f48de4b3d95a  added e
+  |  ()
+  o  7:42dc4f6117ef  added d
+  |  ()
+  | o  6:07ea181fe329  added zoo
+  | |  ()
+  | o  5:e8d0567f11cf  added z
+  | |  (bm1)
+  | o  4:dc7d5acf2389  added y
+  | |  ()
+  o |  3:8be98ac1a569  added c
+  | |  ()
+  | @  2:fa7447a9d391  added x
+  | |  ()
+  o |  1:80e6d2c47cfe  added b
+  |/   ()
+  o  0:f7ad41964313  added a
+ ()
diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -30,6 +30,10 @@
   bookmarks are specified using `-B` flag or multiple 

D2875: remotenames: introduce a config option to allow creation of remote bookmarks

2018-03-22 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 7251.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2875?vs=7105=7251

REVISION DETAIL
  https://phab.mercurial-scm.org/D2875

AFFECTED FILES
  hgext/remotenames.py
  tests/test-logexchange.t

CHANGE DETAILS

diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t
--- a/tests/test-logexchange.t
+++ b/tests/test-logexchange.t
@@ -523,3 +523,57 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: Added a
   
+Testing the remotenames.createbookmark config option
+
+  $ hg bookmarks -R ../server2/
+ $TESTTMP/server/bar 6:87d6d6676308
+ $TESTTMP/server/foo 3:62615734edd5
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+
+  $ hg push ../server2/ -B nonexistant
+  pushing to ../server2/
+  searching for changes
+  abort: bookmark 'nonexistant' does not exists on remote
+  [255]
+
+  $ hg push ../server2/ -r . -B nonexistant --config 
remotenames.createremotebookmark=True
+  pushing to ../server2/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  exporting bookmark nonexistant
+
+  $ hg bookmarks -R ../server2/
+ $TESTTMP/server/bar 6:87d6d6676308
+ $TESTTMP/server/foo 3:62615734edd5
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+ nonexistant   9:aa6a885086c0
+
+  $ hg log -R ../server2/ -r tip
+  changeset:   9:aa6a885086c0
+  branch:  wat
+  bookmark:nonexistant
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: added foobar
+  
+Check synchornising of remotenames after push
+
+  $ hg log -G -r .
+  @  changeset:   9:aa6a885086c0
+  |  branch:  wat
+  ~  tag: tip
+ remote bookmark:  $TESTTMP/server2/nonexistant
+ remote bookmark:  default/foo
+ hoisted name:  foo
+ remote branch:  $TESTTMP/server2/wat
+ remote branch:  default/wat
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: added foobar
+  
diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -29,6 +29,10 @@
   the server. Errors if bookmark does not exists on the server. If multiple
   bookmarks are specified using `-B` flag, fallbacks to default behavior.
   (default: False)
+
+remotenames.createremotebookmark
+  Boolean value indicating whether a creating a new bookmark on the server 
using
+  remotenames.pushtobookmark config is allowed or not. (default: False)
 """
 
 from __future__ import absolute_import
@@ -83,6 +87,9 @@
 configitem('remotenames', 'pushtobookmark',
 default=False,
 )
+configitem('remotenames', 'createremotebookmark',
+default=False,
+)
 
 def expushdiscoverybookmarks(pushop):
 # config not set, fallback to normal push behavior
@@ -102,7 +109,7 @@
 old = ''
 if bookmark in remotemarks:
 old = remotemarks[bookmark]
-else:
+elif not pushop.repo.ui.configbool('remotenames', 'createremotebookmark'):
 msg = _("bookmark '%s' does not exists on remote")
 raise error.Abort(msg % bookmark)
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2875: remotenames: introduce a config option to allow creation of remote bookmarks

2018-03-19 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 7105.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2875?vs=7063=7105

REVISION DETAIL
  https://phab.mercurial-scm.org/D2875

AFFECTED FILES
  hgext/remotenames.py
  tests/test-logexchange.t

CHANGE DETAILS

diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t
--- a/tests/test-logexchange.t
+++ b/tests/test-logexchange.t
@@ -523,3 +523,57 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: Added a
   
+Testing the remotenames.createbookmark config option
+
+  $ hg bookmarks -R ../server2/
+ $TESTTMP/server/bar 6:87d6d6676308
+ $TESTTMP/server/foo 3:62615734edd5
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+
+  $ hg push ../server2/ -B nonexistant
+  pushing to ../server2/
+  searching for changes
+  abort: bookmark 'nonexistant' does not exists on remote
+  [255]
+
+  $ hg push ../server2/ -r . -B nonexistant --config 
remotenames.createremotebookmark=True
+  pushing to ../server2/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  exporting bookmark nonexistant
+
+  $ hg bookmarks -R ../server2/
+ $TESTTMP/server/bar 6:87d6d6676308
+ $TESTTMP/server/foo 3:62615734edd5
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+ nonexistant   9:aa6a885086c0
+
+  $ hg log -R ../server2/ -r tip
+  changeset:   9:aa6a885086c0
+  branch:  wat
+  bookmark:nonexistant
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: added foobar
+  
+Check synchornising of remotenames after push
+
+  $ hg log -G -r .
+  @  changeset:   9:aa6a885086c0
+  |  branch:  wat
+  ~  tag: tip
+ remote bookmark:  $TESTTMP/server2/nonexistant
+ remote bookmark:  default/foo
+ hoistedname:  foo
+ remote branch:  $TESTTMP/server2/wat
+ remote branch:  default/wat
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: added foobar
+  
diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -29,6 +29,10 @@
   the server. Errors if bookmark does not exists on the server. If multiple
   bookmarks are specified using `-B` flag, fallbacks to default behavior.
   (default: False)
+
+remotenames.createremotebookmark
+  Boolean value indicating whether a creating a new bookmark on the server 
using
+  remotenames.pushtobookmark config is allowed or not. (default: False)
 """
 
 from __future__ import absolute_import
@@ -83,6 +87,9 @@
 configitem('remotenames', 'pushtobookmark',
 default=False,
 )
+configitem('remotenames', 'createremotebookmark',
+default=False,
+)
 
 def expushdiscoverybookmarks(pushop):
 # config not set, fallback to normal push behavior
@@ -102,7 +109,7 @@
 old = ''
 if bookmark in remotemarks:
 old = remotemarks[bookmark]
-else:
+elif not pushop.repo.ui.configbool('remotenames', 'createremotebookmark'):
 msg = _("bookmark '%s' does not exists on remote")
 raise error.Abort(msg % bookmark)
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2875: remotenames: introduce a config option to allow creation of remote bookmarks

2018-03-15 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch introduces another config option which if set to true, we can 
create
  new bookmarks on the server using push command. An earlier patch added
  capability to push to a certain bookmark on the server. If bookmark was not
  already present on the server, we errored out. With
  remotenames.createremotebookmark config set, the push will create that 
bookmark
  on the server.
  
  This series serves as a great feature for people who use bookmarks as after 
this
  you can push changesets to a bookmark which does not exists locally. In other
  words, you can push your changesets to a bookmark without having it locally.
  
  This series will help people in having a non-local bookmark workflow involving
  remotenames.
  
  The functionality added in this patch is equivalent to --create flag to push
  command added by hgremotenames extension.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2875

AFFECTED FILES
  hgext/remotenames.py
  tests/test-logexchange.t

CHANGE DETAILS

diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t
--- a/tests/test-logexchange.t
+++ b/tests/test-logexchange.t
@@ -441,3 +441,52 @@
  date:Thu Jan 01 00:00:00 1970 +
  summary: Added a
   
+Testing the remotenames.createbookmark config option
+
+  $ hg bookmarks -R ../server2/
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+
+  $ hg push ../server2/ -B nonexistant
+  pushing to ../server2/
+  searching for changes
+  abort: bookmark 'nonexistant' does not exists on remote
+  [255]
+
+  $ hg push ../server2/ -r . -B nonexistant --config 
remotenames.createremotebookmark=True
+  pushing to ../server2/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  exporting bookmark nonexistant
+
+  $ hg bookmarks -R ../server2/
+ bar   6:87d6d6676308
+ foo   3:62615734edd5
+ nonexistant   9:aa6a885086c0
+
+  $ hg log -R ../server2/ -r tip
+  changeset:   9:aa6a885086c0
+  branch:  wat
+  bookmark:nonexistant
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  summary: added foobar
+  
+Check synchornising of remotenames after push
+
+  $ hg log -G -r .
+  @  changeset:   9:aa6a885086c0
+  |  branch:  wat
+  ~  tag: tip
+ remote bookmark:  $TESTTMP/server2/nonexistant
+ remote bookmark:  default/foo
+ remote branch:  $TESTTMP/server2/wat
+ remote branch:  default/wat
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: added foobar
+  
diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -25,6 +25,10 @@
   the server. Errors if bookmark does not exists on the server. If multiple
   bookmarks are specified using `-B` flag, fallbacks to default behavior.
   (default: False)
+
+remotenames.createremotebookmark
+  Boolean value indicating whether a creating a new bookmark on the server 
using
+  remotenames.pushtobookmark config is allowed or not. (default: False)
 """
 
 from __future__ import absolute_import
@@ -68,6 +72,9 @@
 configitem('remotenames', 'pushtobookmark',
 default=False,
 )
+configitem('remotenames', 'createremotebookmark',
+default=False,
+)
 
 def extsetup(ui):
 exchange.pushdiscoverymapping['bookmarks'] = expushdiscoverybookmarks
@@ -90,7 +97,7 @@
 old = ''
 if bookmark in remotemarks:
 old = remotemarks[bookmark]
-else:
+elif not pushop.repo.ui.configbool('remotenames', 'createremotebookmark'):
 msg = _("bookmark '%s' does not exists on remote")
 raise error.Abort(msg % bookmark)
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel