mercurial@49164: 5 new changesets (4 on stable)

2022-05-06 Thread Mercurial Commits
5 new changesets (4 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/4420e06c8810
changeset:   49160:4420e06c8810
branch:  stable
user:Raphaël Gomès 
date:Wed May 04 17:45:20 2022 +0200
summary: relnotes: add release notes for 6.1.2

https://www.mercurial-scm.org/repo/hg/rev/0ddd5e1f5f67
changeset:   49161:0ddd5e1f5f67
branch:  stable
tag: 6.1.2
user:Raphaël Gomès 
date:Wed May 04 18:00:01 2022 +0200
summary: ci: remove py2-rust support

https://www.mercurial-scm.org/repo/hg/rev/656461a32b7d
changeset:   49162:656461a32b7d
branch:  stable
user:Raphaël Gomès 
date:Wed May 04 18:04:06 2022 +0200
summary: Added tag 6.1.2 for changeset 0ddd5e1f5f67

https://www.mercurial-scm.org/repo/hg/rev/9889bf0fd960
changeset:   49163:9889bf0fd960
branch:  stable
user:Raphaël Gomès 
date:Wed May 04 18:04:46 2022 +0200
summary: Added signature for changeset 0ddd5e1f5f67

https://www.mercurial-scm.org/repo/hg/rev/a932cad26d37
changeset:   49164:a932cad26d37
bookmark:@
tag: tip
parent:  49147:10b9f11daf15
parent:  49161:0ddd5e1f5f67
user:Raphaël Gomès 
date:Wed May 04 18:17:44 2022 +0200
summary: branching: merge stable into default

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 6697] New: How To Delete Cash App Account? - Check Out the Steps In Detail

2022-05-06 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6697

Bug ID: 6697
   Summary: How To Delete Cash App Account? - Check Out the Steps
In Detail
   Product: Mercurial project
   Version: unspecified
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: website
  Assignee: bugzi...@mercurial-scm.org
  Reporter: mahajansanji...@gmail.com
CC: mercurial-devel@mercurial-scm.org

Created attachment 2147
  --> https://bz.mercurial-scm.org/attachment.cgi?id=2147=edit
If you want to deactivate Cash App account, you need to transfer your funds
first, aka cash-out; then, you can close your Cash app account.

If you want to deactivate Cash App account, you need to transfer your funds
first, aka cash-out; then, you can close your Cash app account. 

Our Website - https://autocashapps.com/delete-cash-app-account/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12619: auto-upgrade: skip the operation if the repository cannot be locked

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This seems like a fine default behavior for now. If some users wants something
  more aggressive we can make the behavior configurable in the future.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/helptext/config.txt
  mercurial/upgrade_utils/auto_upgrade.py
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -2069,8 +2069,6 @@
   $ hg status -R auto-upgrade \
   > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
   > --config format.use-dirstate-v2=no
-  abort: could not lock working directory of auto-upgrade: Permission denied
-  [20]
   $ hg debugformat -R auto-upgrade | grep dirstate-v2
   dirstate-v2:yes
 
@@ -2085,8 +2083,6 @@
   $ hg status -R auto-upgrade \
   > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
   > --config format.use-dirstate-v2=no
-  abort: repository auto-upgrade: timed out waiting for lock held by 
'brunhoff/effc:1215708'
-  [20]
   $ hg debugformat -R auto-upgrade | grep dirstate-v2
   dirstate-v2:yes
 
diff --git a/mercurial/upgrade_utils/auto_upgrade.py 
b/mercurial/upgrade_utils/auto_upgrade.py
--- a/mercurial/upgrade_utils/auto_upgrade.py
+++ b/mercurial/upgrade_utils/auto_upgrade.py
@@ -217,19 +217,26 @@
 
 loop = 0
 
-while not clear:
-loop += 1
-if loop > 100:
-# XXX basic protection against infinite loop, make it better.
-raise error.ProgrammingError("Too many auto upgrade loops")
-clear = True
-for get_action in AUTO_UPGRADE_ACTIONS:
-action = get_action(repo)
-if action is not None:
-clear = False
-with repo.wlock(wait=False), repo.lock(wait=False):
-action = get_action(repo)
-if action is not None:
-action()
-repo = maker_func()
+try:
+while not clear:
+loop += 1
+if loop > 100:
+# XXX basic protection against infinite loop, make it better.
+raise error.ProgrammingError("Too many auto upgrade loops")
+clear = True
+for get_action in AUTO_UPGRADE_ACTIONS:
+action = get_action(repo)
+if action is not None:
+clear = False
+with repo.wlock(wait=False), repo.lock(wait=False):
+action = get_action(repo)
+if action is not None:
+action()
+repo = maker_func()
+except error.LockError:
+# if we cannot get the lock, ignore the auto-upgrade attemps and
+# proceed. We might want to make this behavior configurable in the
+# future.
+pass
+
 return repo
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -957,6 +957,9 @@
needed. This also apply to operation that would have been read-only (like hg
status).
 
+   If the repository cannot be locked, the automatic-upgrade operation will be
+   skipped. The next operation will attemps it again.
+
This configuration will apply for move in any direction, either adding the
`dirstate-v2` format if `format.use-dirstate-v2=yes` or removing the
`dirstate-v2` requirement if `format.use-dirstate-v2=no`. So we recommand
@@ -1008,6 +1011,9 @@
change is needed. This also apply to operation that would have been 
read-only
(like hg status).
 
+   If the repository cannot be locked, the automatic-upgrade operation will be
+   skipped. The next operation will attemps it again.
+
This configuration will apply for move in any direction, either adding the
`dirstate-tracked-hint` format if `format.use-dirstate-tracked-hint=yes` or
removing the `dirstate-tracked-hint` requirement if
@@ -1084,6 +1090,9 @@
change is needed. This also apply to operation that would have been
read-only (like hg status).
 
+   If the repository cannot be locked, the automatic-upgrade operation will be
+   skipped. The next operation will attemps it again.
+
This configuration will apply for move in any direction, either adding the
`share-safe` format if `format.use-share-safe=yes` or removing the
`share-safe` requirement if `format.use-share-safe=no`. So we recommand



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org

D12616: debuglock: make the command more useful in non-interactive mode

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The existing prompt mode simply release the lock immediately in 
non-interactive.
  That is quite useless in the test so now the non-interactive mode simply wait
  for a signal.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2185,7 +2185,19 @@
 except error.LockHeld:
 raise error.Abort(_(b'lock is already held'))
 if len(locks):
-ui.promptchoice(_(b"ready to release the lock (y)? $$ "))
+try:
+if ui.interactive():
+prompt = _(b"ready to release the lock (y)? $$ ")
+ui.promptchoice(prompt)
+else:
+msg = b"%d locks held, waiting for signal\n"
+msg %= len(locks)
+ui.status(msg)
+while True:  # XXX wait for a signal
+time.sleep(0.1)
+except KeyboardInterrupt:
+msg = b"signal-received releasing locks\n"
+ui.status(msg)
 return 0
 finally:
 release(*locks)



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


D12618: auto-upgrade: add a test case where the repository is already locked

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This show the current behavior is the repository to auto-upgrade is already
  locked.
  
  The current behavior is to abort, which is probably not great. Now that we 
have
  a proper test, we can think about the behavior we wants in a later tests.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -2076,3 +2076,18 @@
 
   $ chmod -R u+w auto-upgrade
 
+Attempting Auto-upgrade on a locked repository
+--
+
+  $ hg -R auto-upgrade debuglock --set-lock --quiet &
+  $ echo $! >> $DAEMON_PIDS
+  $ $RUNTESTDIR/testlib/wait-on-file 10 auto-upgrade/.hg/store/lock
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-dirstate-v2=no
+  abort: repository auto-upgrade: timed out waiting for lock held by 
'brunhoff/effc:1215708'
+  [20]
+  $ hg debugformat -R auto-upgrade | grep dirstate-v2
+  dirstate-v2:yes
+
+  $ killdaemons.py



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


D12617: wait-on-file: properly wait on any file and symlink

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This make the utility more useful, for example to wait on a lock file.
  We also an explicit -L check since the lock are "weird" symlink.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/testlib/wait-on-file

CHANGE DETAILS

diff --git a/tests/testlib/wait-on-file b/tests/testlib/wait-on-file
--- a/tests/testlib/wait-on-file
+++ b/tests/testlib/wait-on-file
@@ -29,7 +29,7 @@
 touch "$create"
 create=""
 fi
-while [ "$timer" -gt 0 ] && [ ! -f "$wait_on" ]; do
+while [ "$timer" -gt 0 ] && !([ -e "$wait_on" ] || [ -L "$wait_on" ]) ; do
 timer=$(( $timer - 1))
 sleep 0.02
 done



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


D12613: auto-upgrade: introduce a way to auto-upgrade to/from tracked-hint

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is similar to what we introduce for `share-safe`, but apply tot he 
tracked-hint feature.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/helptext/config.txt
  mercurial/upgrade_utils/auto_upgrade.py
  rust/hg-core/src/requirements.rs
  rust/rhg/src/main.rs
  tests/test-help.t
  tests/test-share-safe.t
  tests/test-status-tracked-key.t

CHANGE DETAILS

diff --git a/tests/test-status-tracked-key.t b/tests/test-status-tracked-key.t
--- a/tests/test-status-tracked-key.t
+++ b/tests/test-status-tracked-key.t
@@ -202,3 +202,37 @@
   .hg/dirstate-tracked-hint
   $ hg debugrequires | grep 'tracked'
   dirstate-tracked-key-v1
+  $ cd ..
+
+Test automatic upgrade and downgrade
+
+
+create an initial repository
+
+  $ hg init auto-upgrade \
+  > --config format.use-dirstate-tracked-hint=no
+  $ hg debugbuilddag -R auto-upgrade --new-file .+5
+  $ hg -R auto-upgrade update
+  6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg debugformat -R auto-upgrade | grep tracked
+  tracked-hint:no
+
+upgrade it to dirstate-tracked-hint automatically
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes
 \
+  > --config format.use-dirstate-tracked-hint=yes
+  automatically upgrading repository to the `tracked-hint` feature
+  (see `hg help config.format.use-dirstate-tracked-hint` for details)
+  $ hg debugformat -R auto-upgrade | grep tracked
+  tracked-hint:   yes
+
+downgrade it from dirstate-tracked-hint automatically
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes
 \
+  > --config format.use-dirstate-tracked-hint=no
+  automatically downgrading repository from the `tracked-hint` feature
+  (see `hg help config.format.use-dirstate-tracked-hint` for details)
+  $ hg debugformat -R auto-upgrade | grep tracked
+  tracked-hint:no
diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t
--- a/tests/test-share-safe.t
+++ b/tests/test-share-safe.t
@@ -603,3 +603,36 @@
   |
   o  f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
   
+
+Test automatique upgrade/downgrade of main-repository
+--
+
+create an initial repository
+
+  $ hg init auto-upgrade \
+  > --config format.use-share-safe=no
+  $ hg debugbuilddag -R auto-upgrade --new-file .+5
+  $ hg -R auto-upgrade update
+  6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg debugformat -R auto-upgrade | grep share-safe
+  share-safe:  no
+
+upgrade it to share-safe automatically
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-share-safe.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-share-safe=yes
+  automatically upgrading repository to the `share-safe` feature
+  (see `hg help config.format.use-share-safe` for details)
+  $ hg debugformat -R auto-upgrade | grep share-safe
+  share-safe: yes
+
+downgrade it from share-safe automatically
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-share-safe.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-share-safe=no
+  automatically downgrading repository from the `share-safe` feature
+  (see `hg help config.format.use-share-safe` for details)
+  $ hg debugformat -R auto-upgrade | grep share-safe
+  share-safe:  no
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1599,6 +1599,8 @@
   
   "use-dirstate-tracked-hint"
   
+  "use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories"
+  
   "use-persistent-nodemap"
   
   "use-share-safe"
diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs
--- a/rust/rhg/src/main.rs
+++ b/rust/rhg/src/main.rs
@@ -731,6 +731,11 @@
 ("format", "use-share-safe"),
 requirements::SHARESAFE_REQUIREMENT,
 ),
+(
+("format", 
"use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories"),
+("format", "use-dirstate-tracked-hint"),
+requirements::DIRSTATE_TRACKED_HINT_V1,
+),
 ];
 
 /// Mercurial allows users to automatically upgrade their repository.
diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs
--- a/rust/hg-core/src/requirements.rs
+++ b/rust/hg-core/src/requirements.rs
@@ -100,6 +100,10 @@
 
 pub const DIRSTATE_V2_REQUIREMENT:  = "dirstate-v2";
 
+/// A repository that uses the tracked hint dirstate file
+#[allow(unused)]
+pub const DIRSTATE_TRACKED_HINT_V1:  = "dirstate-tracked-key-v1";
+
 /// When narrowing is finalized and no longer 

D12614: auto-upgrade: introduce a way to auto-upgrade to/from dirstate-v2

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is similar to what we introduce for `share-safe`, but apply tot he
  tracked-hint feature.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/helptext/config.txt
  mercurial/upgrade_utils/auto_upgrade.py
  rust/rhg/src/main.rs
  tests/test-help.t
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -1994,3 +1994,70 @@
   dirstate-v2: no
 
   $ cd ..
+
+Test automatic upgrade/downgrade
+
+
+
+For dirstate v2
+---
+
+create an initial repository
+
+  $ hg init auto-upgrade \
+  > --config format.use-dirstate-v2=no \
+  > --config format.use-dirstate-tracked-hint=yes \
+  > --config format.use-share-safe=no
+  $ hg debugbuilddag -R auto-upgrade --new-file .+5
+  $ hg -R auto-upgrade update
+  6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg debugformat -R auto-upgrade | grep dirstate-v2
+  dirstate-v2: no
+
+upgrade it to dirstate-v2 automatically
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-dirstate-v2=yes
+  automatically upgrading repository to the `dirstate-v2` feature
+  (see `hg help config.format.use-dirstate-v2` for details)
+  $ hg debugformat -R auto-upgrade | grep dirstate-v2
+  dirstate-v2:yes
+
+downgrade it from dirstate-v2 automatically
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-dirstate-v2=no
+  automatically downgrading repository from the `dirstate-v2` feature
+  (see `hg help config.format.use-dirstate-v2` for details)
+  $ hg debugformat -R auto-upgrade | grep dirstate-v2
+  dirstate-v2: no
+
+
+For multiple change at the same time
+
+
+  $ hg debugformat -R auto-upgrade | egrep '(dirstate-v2|tracked|share-safe)'
+  dirstate-v2: no
+  tracked-hint:   yes
+  share-safe:  no
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-dirstate-v2=yes \
+  > --config 
format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes
 \
+  > --config format.use-dirstate-tracked-hint=no\
+  > --config 
format.use-share-safe.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-share-safe=yes
+  automatically upgrading repository to the `dirstate-v2` feature
+  (see `hg help config.format.use-dirstate-v2` for details)
+  automatically upgrading repository to the `share-safe` feature
+  (see `hg help config.format.use-share-safe` for details)
+  automatically downgrading repository from the `tracked-hint` feature
+  (see `hg help config.format.use-dirstate-tracked-hint` for details)
+  $ hg debugformat -R auto-upgrade | egrep '(dirstate-v2|tracked|share-safe)'
+  dirstate-v2:yes
+  tracked-hint:no
+  share-safe: yes
+
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1597,6 +1597,8 @@
   
   "use-dirstate-v2"
   
+  "use-dirstate-v2.automatic-upgrade-of-mismatching-repositories"
+  
   "use-dirstate-tracked-hint"
   
   "use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories"
diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs
--- a/rust/rhg/src/main.rs
+++ b/rust/rhg/src/main.rs
@@ -736,6 +736,11 @@
 ("format", "use-dirstate-tracked-hint"),
 requirements::DIRSTATE_TRACKED_HINT_V1,
 ),
+(
+("use-dirstate-v2", "automatic-upgrade-of-mismatching-repositories"),
+("format", "use-dirstate-v2"),
+requirements::DIRSTATE_V2_REQUIREMENT,
+),
 ];
 
 /// Mercurial allows users to automatically upgrade their repository.
diff --git a/mercurial/upgrade_utils/auto_upgrade.py 
b/mercurial/upgrade_utils/auto_upgrade.py
--- a/mercurial/upgrade_utils/auto_upgrade.py
+++ b/mercurial/upgrade_utils/auto_upgrade.py
@@ -136,7 +136,64 @@
 return action
 
 
+def get_dirstate_v2_action(repo):
+"""return an automatic-upgrade action for `dirstate-v2` if applicable
+
+If no action is needed, return None, otherwise return a callback to upgrade
+or downgrade the repository according the configuration and repository
+format.
+"""
+ui = repo.ui
+requirements = set(repo.requirements)
+auto_upgrade_tracked_hint = ui.configbool(
+b'format',
+b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories',

D12611: auto-upgrade: introduce a way to auto-upgrade to/from share-safe

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the first "automatic-upgrade" capabilities. In the following commits,
  similar features are coming for other "fast to upgrade" format.
  
  This is different from the `safe-mismatch.source-not-safe` and
  `safe-mismatch.source-safe` configuration that deal with mismatch between a
  share and its share-source. Here we are dealing with mismatch between 
repository
  configuration and its actual format.
  
  We will need further work for cases were the repository cannot be locked. A
  basic protection is in place to avoid infinite loop for now, but it will get
  proper attention in a later changesets.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/helptext/config.txt
  mercurial/localrepo.py
  mercurial/upgrade.py
  mercurial/upgrade_utils/auto_upgrade.py
  rust/rhg/src/main.rs
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1603,6 +1603,8 @@
   
   "use-share-safe"
   
+  "use-share-safe.automatic-upgrade-of-mismatching-repositories"
+  
   "usestore"
   
   "sparse-revlog"
diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs
--- a/rust/rhg/src/main.rs
+++ b/rust/rhg/src/main.rs
@@ -7,10 +7,10 @@
 use clap::ArgMatches;
 use format_bytes::{format_bytes, join};
 use hg::config::{Config, ConfigSource};
-use hg::exit_codes;
 use hg::repo::{Repo, RepoError};
 use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes};
 use hg::utils::SliceExt;
+use hg::{exit_codes, requirements};
 use std::collections::HashSet;
 use std::ffi::OsString;
 use std::os::unix::prelude::CommandExt;
@@ -724,6 +724,50 @@
 }
 }
 
+/// Array of tuples of (auto upgrade conf, feature conf, local requirement)
+const AUTO_UPGRADES: &[((, ), (, ), )] = &[
+(
+("format", 
"use-share-safe.automatic-upgrade-of-mismatching-repositories"),
+("format", "use-share-safe"),
+requirements::SHARESAFE_REQUIREMENT,
+),
+];
+
+/// Mercurial allows users to automatically upgrade their repository.
+/// `rhg` does not have the ability to upgrade yet, so fallback if an upgrade
+/// is needed.
+fn check_auto_upgrade(
+config: ,
+reqs: ,
+) -> Result<(), CommandError> {
+for (upgrade_conf, feature_conf, local_req) in AUTO_UPGRADES.iter() {
+let auto_upgrade = config
+.get_bool(upgrade_conf.0.as_bytes(), upgrade_conf.1.as_bytes())?;
+
+if auto_upgrade {
+let want_it = config.get_bool(
+feature_conf.0.as_bytes(),
+feature_conf.1.as_bytes(),
+)?;
+let have_it = reqs.contains(*local_req);
+
+let action = match (want_it, have_it) {
+(true, false) => Some("upgrade"),
+(false, true) => Some("downgrade"),
+_ => None,
+};
+if let Some(action) = action {
+let message = format!(
+"automatic {} {}.{}",
+action, upgrade_conf.0, upgrade_conf.1
+);
+return Err(CommandError::unsupported(message));
+}
+}
+}
+Ok(())
+}
+
 fn check_unsupported(
 config: ,
 repo: Result<, >,
@@ -740,6 +784,7 @@
 if repo.has_subrepos()? {
 Err(CommandError::unsupported("sub-repositories"))?
 }
+check_auto_upgrade(config, repo.requirements())?;
 }
 
 if config.has_non_empty_section(b"encode") {
diff --git a/mercurial/upgrade_utils/auto_upgrade.py 
b/mercurial/upgrade_utils/auto_upgrade.py
new file mode 100644
--- /dev/null
+++ b/mercurial/upgrade_utils/auto_upgrade.py
@@ -0,0 +1,107 @@
+# upgrade.py - functions for automatic upgrade of Mercurial repository
+#
+# Copyright (c) 2022-present, Pierre-Yves David
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+from ..i18n import _
+
+from .. import (
+error,
+requirements as requirementsmod,
+scmutil,
+)
+
+
+def get_share_safe_action(repo):
+"""return an automatic-upgrade action for `share-safe` if applicable
+
+If no action is needed, return None, otherwise return a callback to upgrade
+or downgrade the repository according the configuration and repository
+format.
+"""
+ui = repo.ui
+requirements = repo.requirements
+auto_upgrade_share_source = ui.configbool(
+b'format',
+b'use-share-safe.automatic-upgrade-of-mismatching-repositories',
+)
+
+action = None
+
+if (
+auto_upgrade_share_source
+and requirementsmod.SHARED_REQUIREMENT not in requirements
+):
+sf_config = ui.configbool(b'format', 

D12615: auto-upgrade: add a test case with no permission to lock the repository

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This show the current behavior is the repository is unlockable.
  
  The current behavior is to abort, which is probably not great. Now that we 
have
  a proper test, we can think about the behavior we wants in a later tests.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-upgrade-repo.t

CHANGE DETAILS

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -2061,3 +2061,18 @@
   tracked-hint:no
   share-safe: yes
 
+Attempting Auto-upgrade on a read-only repository
+-
+
+  $ chmod -R a-w auto-upgrade
+
+  $ hg status -R auto-upgrade \
+  > --config 
format.use-dirstate-v2.automatic-upgrade-of-mismatching-repositories=yes \
+  > --config format.use-dirstate-v2=no
+  abort: could not lock working directory of auto-upgrade: Permission denied
+  [20]
+  $ hg debugformat -R auto-upgrade | grep dirstate-v2
+  dirstate-v2:yes
+
+  $ chmod -R u+w auto-upgrade
+



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


D12612: upgrade: split some logic from UpgradeOperation

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The automatic-upgrade and the upgrade-repo code path should be able to use the
  same code. However that code often need an UpgradeOperation object to 
function.
  So we start spliting the Operation into a minimal component that we will be
  able to reuse outside of the "classic" upgrade path.
  
  We will put the base-class to use in the next changesets.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade_utils/actions.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/actions.py 
b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -685,7 +685,24 @@
 return newactions
 
 
-class UpgradeOperation:
+class BaseOperation:
+"""base class that contains the minimum for an upgrade to work
+
+(this might need to be extended as the usage for subclass alternative to
+UpgradeOperation extends)
+"""
+
+def __init__(
+self,
+new_requirements,
+backup_store,
+):
+self.new_requirements = new_requirements
+# should this operation create a backup of the store
+self.backup_store = backup_store
+
+
+class UpgradeOperation(BaseOperation):
 """represent the work to be done during an upgrade"""
 
 def __init__(
@@ -698,8 +715,11 @@
 revlogs_to_process,
 backup_store,
 ):
+super().__init__(
+new_requirements,
+backup_store,
+)
 self.ui = ui
-self.new_requirements = new_requirements
 self.current_requirements = current_requirements
 # list of upgrade actions the operation will perform
 self.upgrade_actions = upgrade_actions
@@ -741,9 +761,6 @@
 b're-delta-multibase' in upgrade_actions_names
 )
 
-# should this operation create a backup of the store
-self.backup_store = backup_store
-
 @property
 def upgrade_actions_names(self):
 return set([a.name for a in self.upgrade_actions])



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


D12610: rust: make requirements public

2022-05-06 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These can be used by any client crates (including `rhg`), no need to make them
  private to the crate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/requirements.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs
--- a/rust/hg-core/src/requirements.rs
+++ b/rust/hg-core/src/requirements.rs
@@ -98,35 +98,35 @@
 
 // Copied from mercurial/requirements.py:
 
-pub(crate) const DIRSTATE_V2_REQUIREMENT:  = "dirstate-v2";
+pub const DIRSTATE_V2_REQUIREMENT:  = "dirstate-v2";
 
 /// When narrowing is finalized and no longer subject to format changes,
 /// we should move this to just "narrow" or similar.
 #[allow(unused)]
-pub(crate) const NARROW_REQUIREMENT:  = "narrowhg-experimental";
+pub const NARROW_REQUIREMENT:  = "narrowhg-experimental";
 
 /// Bookmarks must be stored in the `store` part of the repository and will be
 /// share accross shares
 #[allow(unused)]
-pub(crate) const BOOKMARKS_IN_STORE_REQUIREMENT:  = "bookmarksinstore";
+pub const BOOKMARKS_IN_STORE_REQUIREMENT:  = "bookmarksinstore";
 
 /// Enables sparse working directory usage
 #[allow(unused)]
-pub(crate) const SPARSE_REQUIREMENT:  = "exp-sparse";
+pub const SPARSE_REQUIREMENT:  = "exp-sparse";
 
 /// Enables the internal phase which is used to hide changesets instead
 /// of stripping them
 #[allow(unused)]
-pub(crate) const INTERNAL_PHASE_REQUIREMENT:  = "internal-phase";
+pub const INTERNAL_PHASE_REQUIREMENT:  = "internal-phase";
 
 /// Stores manifest in Tree structure
 #[allow(unused)]
-pub(crate) const TREEMANIFEST_REQUIREMENT:  = "treemanifest";
+pub const TREEMANIFEST_REQUIREMENT:  = "treemanifest";
 
 /// Increment the sub-version when the revlog v2 format changes to lock out old
 /// clients.
 #[allow(unused)]
-pub(crate) const REVLOGV2_REQUIREMENT:  = "exp-revlogv2.1";
+pub const REVLOGV2_REQUIREMENT:  = "exp-revlogv2.1";
 
 /// A repository with the sparserevlog feature will have delta chains that
 /// can spread over a larger span. Sparse reading cuts these large spans into
@@ -137,32 +137,32 @@
 /// chain. This is why once a repository has enabled sparse-read, it becomes
 /// required.
 #[allow(unused)]
-pub(crate) const SPARSEREVLOG_REQUIREMENT:  = "sparserevlog";
+pub const SPARSEREVLOG_REQUIREMENT:  = "sparserevlog";
 
 /// A repository with the the copies-sidedata-changeset requirement will store
 /// copies related information in changeset's sidedata.
 #[allow(unused)]
-pub(crate) const COPIESSDC_REQUIREMENT:  = "exp-copies-sidedata-changeset";
+pub const COPIESSDC_REQUIREMENT:  = "exp-copies-sidedata-changeset";
 
 /// The repository use persistent nodemap for the changelog and the manifest.
 #[allow(unused)]
-pub(crate) const NODEMAP_REQUIREMENT:  = "persistent-nodemap";
+pub const NODEMAP_REQUIREMENT:  = "persistent-nodemap";
 
 /// Denotes that the current repository is a share
 #[allow(unused)]
-pub(crate) const SHARED_REQUIREMENT:  = "shared";
+pub const SHARED_REQUIREMENT:  = "shared";
 
 /// Denotes that current repository is a share and the shared source path is
 /// relative to the current repository root path
 #[allow(unused)]
-pub(crate) const RELATIVE_SHARED_REQUIREMENT:  = "relshared";
+pub const RELATIVE_SHARED_REQUIREMENT:  = "relshared";
 
 /// A repository with share implemented safely. The repository has different
 /// store and working copy requirements i.e. both `.hg/requires` and
 /// `.hg/store/requires` are present.
 #[allow(unused)]
-pub(crate) const SHARESAFE_REQUIREMENT:  = "share-safe";
+pub const SHARESAFE_REQUIREMENT:  = "share-safe";
 
 /// A repository that use zstd compression inside its revlog
 #[allow(unused)]
-pub(crate) const REVLOG_COMPRESSION_ZSTD:  = "revlog-compression-zstd";
+pub const REVLOG_COMPRESSION_ZSTD:  = "revlog-compression-zstd";



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