[Bug 6461] New: doc: fix documentation issues

2020-12-30 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6461

Bug ID: 6461
   Summary: doc: fix documentation issues
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: evolution
  Assignee: bugzi...@mercurial-scm.org
  Reporter: ctuf...@gmail.com
CC: mercurial-devel@mercurial-scm.org,
pierre-yves.da...@ens-lyon.org
Python Version: ---

Created attachment 2095
  --> https://bz.mercurial-scm.org/attachment.cgi?id=2095=edit
doc: fix build warning for index.rst

This series fixes a few issues seen with the generated documentation

1) The index page include a reference to itself leading to a) a build warning
but more importantly, b) prevented the correct navigation linking to the user
guide

2) The MQ refugee page includes references to commands marked as deprecated.
Change these to the current equivalents. While in the neighborhood, clean up
some typos and improve the formatting.

-- 
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


D9671: rust: fix file folding map

2020-12-30 Thread danchr (Dan Villiom Podlaski Christiansen)
danchr created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The file folding map, frequently used on macOS, had two issues:
  
  - the means for converting it to Python didn't work
  - a minor typo when copying the python code, where `!=` became `==`
  
  With this, the rust code passes all tests on macOS.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -350,8 +350,8 @@
 {
 dict.set_item(
 py,
-key.as_bytes().to_vec(),
-value.as_bytes().to_vec(),
+PyBytes::new(py, key.as_bytes()).into_object(),
+PyBytes::new(py, value.as_bytes()).into_object(),
 )?;
 }
 Ok(dict)
diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs 
b/rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs
@@ -431,7 +431,7 @@
 let mut new_file_fold_map = FileFoldMap::default();
 
 for (filename, DirstateEntry { state, .. }) in self.state_map.iter() {
-if *state == EntryState::Removed {
+if *state != EntryState::Removed {
 new_file_fold_map
 .insert(normalize_case(), filename.to_owned());
 }
@@ -447,7 +447,7 @@
 let mut new_file_fold_map = FileFoldMap::default();
 
 for (filename, DirstateEntry { state, .. }) in self.state_map.iter() {
-if state == EntryState::Removed {
+if state != EntryState::Removed {
 new_file_fold_map
 .insert(normalize_case(), filename.to_owned());
 }



To: danchr, #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


D9670: rust: fix testing with $TMPDIR ≠ /tmp

2020-12-30 Thread danchr (Dan Villiom Podlaski Christiansen)
danchr created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/utils/path_auditor.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/utils/path_auditor.rs 
b/rust/hg-core/src/utils/path_auditor.rs
--- a/rust/hg-core/src/utils/path_auditor.rs
+++ b/rust/hg-core/src/utils/path_auditor.rs
@@ -206,6 +206,7 @@
 
 let base_dir = tempdir().unwrap();
 let base_dir_path = base_dir.path();
+let skip = base_dir_path.components().count() - 1;
 let a = base_dir_path.join("a");
 let b = base_dir_path.join("b");
 create_dir().unwrap();
@@ -215,7 +216,7 @@
 // TODO make portable
 std::os::unix::fs::symlink(, ).unwrap();
 
-let buf = b.join("in_a").components().skip(2).collect::();
+let buf = b.join("in_a").components().skip(skip).collect::();
 eprintln!("buf: {}", buf.display());
 let path = path_to_hg_path_buf(buf).unwrap();
 assert_eq!(



To: danchr, #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


D9669: engine: prevent multiple checking of re-delta-multibase

2020-12-30 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The _perform_clone function is called for each revlog cloned, hence we should
  prevent this function call overhead.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade_utils/actions.py
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/engine.py 
b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -140,9 +140,7 @@
 newrl,
 addrevisioncb=oncopiedrevision,
 deltareuse=upgrade_op.delta_reuse_mode,
-forcedeltabothparents=upgrade_op.has_upgrade_action(
-b're-delta-multibase'
-),
+forcedeltabothparents=upgrade_op.force_re_delta_both_parents,
 sidedatacompanion=sidedatacompanion,
 )
 else:
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
@@ -658,6 +658,11 @@
 elif b're-delta-fulladd' in self._upgrade_actions_names:
 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
 
+# should this operation force re-delta of both parents
+self.force_re_delta_both_parents = (
+b're-delta-multibase' in self._upgrade_actions_names
+)
+
 def _write_labeled(self, l, label):
 """
 Utility function to aid writing of a list under one label



To: pulkit, #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


D9668: engine: pass upgrade operation inside `_perform_clone()`

2020-12-30 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Same as previous patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/engine.py 
b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -124,15 +124,13 @@
 tr,
 old_revlog,
 unencoded,
-deltareuse,
-forcedeltabothparents,
-revlogs,
+upgrade_op,
 sidedatacompanion,
 oncopiedrevision,
 ):
 """ returns the new revlog object created"""
 newrl = None
-if matchrevlog(revlogs, unencoded):
+if matchrevlog(upgrade_op.revlogs_to_process, unencoded):
 ui.note(
 _(b'cloning %d revisions from %s\n') % (len(old_revlog), unencoded)
 )
@@ -141,8 +139,10 @@
 tr,
 newrl,
 addrevisioncb=oncopiedrevision,
-deltareuse=deltareuse,
-forcedeltabothparents=forcedeltabothparents,
+deltareuse=upgrade_op.delta_reuse_mode,
+forcedeltabothparents=upgrade_op.has_upgrade_action(
+b're-delta-multibase'
+),
 sidedatacompanion=sidedatacompanion,
 )
 else:
@@ -276,9 +276,7 @@
 tr,
 oldrl,
 unencoded,
-upgrade_op.delta_reuse_mode,
-upgrade_op.has_upgrade_action(b're-delta-multibase'),
-upgrade_op.revlogs_to_process,
+upgrade_op,
 sidedatacompanion,
 oncopiedrevision,
 )
@@ -317,9 +315,7 @@
 tr,
 oldrl,
 unencoded,
-upgrade_op.delta_reuse_mode,
-upgrade_op.has_upgrade_action(b're-delta-multibase'),
-upgrade_op.revlogs_to_process,
+upgrade_op,
 sidedatacompanion,
 oncopiedrevision,
 )
@@ -357,9 +353,7 @@
 tr,
 oldrl,
 unencoded,
-upgrade_op.delta_reuse_mode,
-upgrade_op.has_upgrade_action(b're-delta-multibase'),
-upgrade_op.revlogs_to_process,
+upgrade_op,
 sidedatacompanion,
 oncopiedrevision,
 )



To: pulkit, #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


D9667: engine: pass upgrade operation inside _clonerevlogs()

2020-12-30 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Better to pass the operation instead of passing three of it's members (one of
  the them is a function call) separately.
  
  This will also be useful in future when we will like to control which things 
are
  upgraded.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/engine.py 
b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -159,9 +159,7 @@
 srcrepo,
 dstrepo,
 tr,
-deltareuse,
-forcedeltabothparents,
-revlogs=UPGRADE_ALL_REVLOGS,
+upgrade_op,
 ):
 """Copy revlogs between 2 repos."""
 revcount = 0
@@ -278,9 +276,9 @@
 tr,
 oldrl,
 unencoded,
-deltareuse,
-forcedeltabothparents,
-revlogs,
+upgrade_op.delta_reuse_mode,
+upgrade_op.has_upgrade_action(b're-delta-multibase'),
+upgrade_op.revlogs_to_process,
 sidedatacompanion,
 oncopiedrevision,
 )
@@ -319,9 +317,9 @@
 tr,
 oldrl,
 unencoded,
-deltareuse,
-forcedeltabothparents,
-revlogs,
+upgrade_op.delta_reuse_mode,
+upgrade_op.has_upgrade_action(b're-delta-multibase'),
+upgrade_op.revlogs_to_process,
 sidedatacompanion,
 oncopiedrevision,
 )
@@ -359,9 +357,9 @@
 tr,
 oldrl,
 unencoded,
-deltareuse,
-forcedeltabothparents,
-revlogs,
+upgrade_op.delta_reuse_mode,
+upgrade_op.has_upgrade_action(b're-delta-multibase'),
+upgrade_op.revlogs_to_process,
 sidedatacompanion,
 oncopiedrevision,
 )
@@ -452,9 +450,7 @@
 srcrepo,
 dstrepo,
 tr,
-upgrade_op.delta_reuse_mode,
-upgrade_op.has_upgrade_action(b're-delta-multibase'),
-revlogs=upgrade_op.revlogs_to_process,
+upgrade_op,
 )
 
 # Now copy other files in the store directory.



To: pulkit, #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


D9666: actions: store deltareuse mode of whole operation in UpgradeOperation

2020-12-30 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  UpgradeOperation should provide easy access to all the things related to the
  current operation. Clients should not need to compute them.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade_utils/actions.py
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/engine.py 
b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -446,24 +446,13 @@
 )
 )
 
-if upgrade_op.has_upgrade_action(b're-delta-all'):
-deltareuse = revlog.revlog.DELTAREUSENEVER
-elif upgrade_op.has_upgrade_action(b're-delta-parent'):
-deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-elif upgrade_op.has_upgrade_action(b're-delta-multibase'):
-deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-elif upgrade_op.has_upgrade_action(b're-delta-fulladd'):
-deltareuse = revlog.revlog.DELTAREUSEFULLADD
-else:
-deltareuse = revlog.revlog.DELTAREUSEALWAYS
-
 with dstrepo.transaction(b'upgrade') as tr:
 _clonerevlogs(
 ui,
 srcrepo,
 dstrepo,
 tr,
-deltareuse,
+upgrade_op.delta_reuse_mode,
 upgrade_op.has_upgrade_action(b're-delta-multibase'),
 revlogs=upgrade_op.revlogs_to_process,
 )
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
@@ -12,6 +12,7 @@
 error,
 localrepo,
 requirements,
+revlog,
 util,
 )
 
@@ -646,6 +647,17 @@
 i for i in all_optimizations if i not in self.upgrade_actions
 ]
 
+# delta reuse mode of this upgrade operation
+self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
+if b're-delta-all' in self._upgrade_actions_names:
+self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
+elif b're-delta-parent' in self._upgrade_actions_names:
+self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
+elif b're-delta-multibase' in self._upgrade_actions_names:
+self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
+elif b're-delta-fulladd' in self._upgrade_actions_names:
+self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
+
 def _write_labeled(self, l, label):
 """
 Utility function to aid writing of a list under one label



To: pulkit, #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


D9665: engine: refactor how total dstsize is calculated

2020-12-30 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Instead of increasing it with each revlog, we just get the sum of total
  destination changelog, manifest and filelogs sizes.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/engine.py 
b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -285,9 +285,7 @@
 oncopiedrevision,
 )
 info = newrl.storageinfo(storedsize=True)
-datasize = info[b'storedsize'] or 0
-dstsize += datasize
-fdstsize += datasize
+fdstsize += info[b'storedsize'] or 0
 ui.status(
 _(
 b'finished migrating %d filelog revisions across %d '
@@ -328,9 +326,7 @@
 oncopiedrevision,
 )
 info = newrl.storageinfo(storedsize=True)
-datasize = info[b'storedsize'] or 0
-dstsize += datasize
-mdstsize += datasize
+mdstsize += info[b'storedsize'] or 0
 ui.status(
 _(
 b'finished migrating %d manifest revisions across %d '
@@ -370,9 +366,7 @@
 oncopiedrevision,
 )
 info = newrl.storageinfo(storedsize=True)
-datasize = info[b'storedsize'] or 0
-dstsize += datasize
-cdstsize += datasize
+cdstsize += info[b'storedsize'] or 0
 progress.complete()
 ui.status(
 _(
@@ -382,6 +376,7 @@
 % (crevcount, util.bytecount(cdstsize - csrcsize))
 )
 
+dstsize = fdstsize + mdstsize + cdstsize
 ui.status(
 _(
 b'finished migrating %d total revisions; total change in store '



To: pulkit, #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


D9664: actions: rename DEFICIENCY constant to FORMAT_VARIANT

2020-12-30 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It was not obvious what does deficieny means and every format change can't be 
a
  deficiency. There are some format changes like compression levels, share-safe
  which can't be understood at deficiencies.
  
  This patch renames the constant to make things clearer.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -28,7 +28,7 @@
 return set()
 
 
-DEFICIENCY = b'deficiency'
+FORMAT_VARIANT = b'deficiency'
 OPTIMISATION = b'optimization'
 
 
@@ -42,13 +42,15 @@
will be mapped to an action later in the upgrade process.
 
 type
-   Either ``DEFICIENCY`` or ``OPTIMISATION``. A deficiency is an obvious
-   problem. An optimization is an action (sometimes optional) that
+   Either ``FORMAT_VARIANT`` or ``OPTIMISATION``.
+   A format variant is where we change the storage format. Not all format
+   variant changes are an obvious problem.
+   An optimization is an action (sometimes optional) that
can be taken to further improve the state of the repository.
 
 description
Message intended for humans explaining the improvement in more detail,
-   including the implications of it. For ``DEFICIENCY`` types, should be
+   including the implications of it. For ``FORMAT_VARIANT`` types, should 
be
worded in the present tense. For ``OPTIMISATION`` types, should be
worded in the future tense.
 
@@ -87,7 +89,7 @@
 class formatvariant(improvement):
 """an improvement subclass dedicated to repository format"""
 
-type = DEFICIENCY
+type = FORMAT_VARIANT
 ### The following attributes should be defined for each class:
 
 # machine-readable string uniquely identifying this improvement. it will be
@@ -95,7 +97,8 @@
 name = None
 
 # message intended for humans explaining the improvement in more detail,
-# including the implications of it ``DEFICIENCY`` types, should be worded
+# including the implications of it ``FORMAT_VARIANT`` types, should be
+# worded
 # in the present tense.
 description = None
 



To: pulkit, #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