D9624: extdiff: add --from/--to and deprecate -r, as was done for `hg diff`

2020-12-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I recently replaced `hg diff`'s `-r` flag by `--from` and `--to` and
  then deprecated the `-r` flag. This patch repeats that for
  `hg extdiff`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/extdiff.py
  tests/test-extdiff.t
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -836,10 +836,8 @@
   program, use -o/--option. These will be passed before the names of the
   directories or files to compare.
   
-  When two revision arguments are given, then changes are shown between
-  those revisions. If only one revision is specified then that revision is
-  compared to the working directory, and, when no revisions are specified,
-  the working directory files are compared to its parent.
+  The --from, --to, and --change options work the same way they do for 'hg
+  diff'.
   
   The --per-file option runs the external program repeatedly on each file 
to
   diff, instead of once on two directories. By default, this happens one by
@@ -859,7 +857,8 @@
   
-p --program CMD comparison program to run
-o --option OPT [+]  pass option to comparison program
-   -r --rev REV [+] revision
+  --from REV1   revision to diff from
+  --to REV2 revision to diff to
-c --change REV  change made by revision
   --per-filecompare each file instead of revision snapshots
   --confirm prompt user before each external program invocation
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -50,7 +50,8 @@
   options ([+] can be repeated):
   
-o --option OPT [+]  pass option to comparison program
-   -r --rev REV [+] revision
+  --from REV1   revision to diff from
+  --to REV2 revision to diff to
-c --change REV  change made by revision
   --per-filecompare each file instead of revision snapshots
   --confirm prompt user before each external program invocation
@@ -68,14 +69,14 @@
 
 Should diff cloned files directly:
 
-  $ hg falabala -r 0:1
+  $ hg falabala --from 0 --to 1
   diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) 
(windows !)
   diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) (no-windows !)
   [1]
 
 Can show diff from working copy:
   $ echo c >> a
-  $ hg falabala -r 'wdir()' -r 1
+  $ hg falabala --to 1
   diffing "*\\extdiff.*\\a" "a.34eed99112ab\\a" (glob) (windows !)
   diffing */extdiff.*/a a.34eed99112ab/a (glob) (no-windows !)
   [1]
@@ -139,7 +140,7 @@
   $ hg ci -Sm "adding subrepo"
   $ echo > .hgsub
   $ hg ci -m "removing subrepo"
-  $ hg falabala -r 4 -r 5 -S
+  $ hg falabala --from 4 --to 5 -S
   diffing a.398e36faf9c6 a.5ab95fb166c4
   [1]
 
@@ -292,7 +293,7 @@
   > kdiff3.diffargs=--L1 \$plabel1 --L2 \$clabel \$parent \$child
   > EOF
 
-  $ hg --debug kdiff3 -r0 | grep '^running'
+  $ hg --debug kdiff3 --from 0 | grep '^running'
   running 'echo --L1 "@0" --L2 "" a.8a5febb7f867 a' in * (glob) (windows !)
   running "echo --L1 '@0' --L2 '' a.8a5febb7f867 a" in * (glob) (no-windows !)
 
@@ -496,7 +497,7 @@
   $ echo a >> a
   $ ln -s missing linka
   $ hg add linka
-  $ hg falabala -r 0 --traceback
+  $ hg falabala --from 0 --traceback
   diffing testsymlinks.07f494440405 testsymlinks
   [1]
   $ cd ..
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -552,12 +552,21 @@
 
 cmdutil.check_at_most_one_arg(opts, b'rev', b'change')
 revs = opts.get(b'rev')
+from_rev = opts.get(b'from')
+to_rev = opts.get(b'to')
 change = opts.get(b'change')
 do3way = b'$parent2' in cmdline
 
 if change:
 ctx2 = scmutil.revsingle(repo, change, None)
 ctx1a, ctx1b = ctx2.p1(), ctx2.p2()
+elif from_rev or to_rev:
+repo = scmutil.unhidehashlikerevs(
+repo, [from_rev] + [to_rev], b'nowarn'
+)
+ctx1a = scmutil.revsingle(repo, from_rev, None)
+ctx1b = repo[nullid]
+ctx2 = scmutil.revsingle(repo, to_rev, None)
 else:
 ctx1a, ctx2 = scmutil.revpair(repo, revs)
 if not revs:
@@ -615,7 +624,9 @@
 _(b'pass option to comparison program'),
 _(b'OPT'),
 ),
-(b'r', b'rev', [], _(b'revision'), _(b'REV')),
+(b'r', b'rev', [], _(b'revision (DEPRECATED)'), _(b'REV')),
+(b'', b'from', b'', _(b'revision to diff from'), _(b'REV1')),
+(b'', b'to', b'', _(b'revision to diff to'), _(b'REV2')),
 (b'c', b'change', b'', _(b'change made by revision'), _(b'REV')),
 (
   

D9623: extdiff: fix crash when showing diff from wdir()

2020-12-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz 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/D9623

AFFECTED FILES
  hgext/extdiff.py
  tests/test-extdiff.t

CHANGE DETAILS

diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -73,6 +73,15 @@
   diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) (no-windows !)
   [1]
 
+Can show diff from working copy:
+  $ echo c >> a
+  $ hg falabala -r 'wdir()' -r 1
+  diffing "*\\extdiff.*\\a" "a.34eed99112ab\\a" (glob) (windows !)
+  diffing */extdiff.*/a a.34eed99112ab/a (glob) (no-windows !)
+  [1]
+  $ hg revert a
+  $ rm a.orig
+
 Specifying an empty revision should abort.
 
   $ hg extdiff -p diff --patch --rev 'ancestor()' --rev 1
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -433,7 +433,7 @@
 # ctx1a)
 dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a)
 dir1a = snapshot(ui, repo, dir1a_files, ctx1a.node(), tmproot, subrepos)[0]
-rev1a = b'@%d' % ctx1a.rev()
+rev1a = b'' if ctx1a.rev() is None else b'@%d' % ctx1a.rev()
 if do3way:
 # file calculation criteria same as dir1a
 dir1b_files = mod_b | rem_b | ((mod_a | add_a) - add_b)



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


D9622: extdiff: pass contexts instead of nodeids into diffrevs()

2020-12-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This just avoids some unnecessary lookups.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/extdiff.py

CHANGE DETAILS

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -395,9 +395,9 @@
 def diffrevs(
 ui,
 repo,
-node1a,
-node1b,
-node2,
+ctx1a,
+ctx1b,
+ctx2,
 matcher,
 tmproot,
 cmdline,
@@ -409,10 +409,10 @@
 subrepos = opts.get(b'subrepos')
 
 # calculate list of files changed between both revs
-st = repo.status(node1a, node2, matcher, listsubrepos=subrepos)
+st = ctx1a.status(ctx2, matcher, listsubrepos=subrepos)
 mod_a, add_a, rem_a = set(st.modified), set(st.added), set(st.removed)
 if do3way:
-stb = repo.status(node1b, node2, matcher, listsubrepos=subrepos)
+stb = ctx1b.status(ctx2, matcher, listsubrepos=subrepos)
 mod_b, add_b, rem_b = (
 set(stb.modified),
 set(stb.added),
@@ -425,32 +425,34 @@
 if not common:
 return 0
 
-# Always make a copy of node1a (and node1b, if applicable)
+# Always make a copy of ctx1a (and ctx1b, if applicable)
 # dir1a should contain files which are:
-#   * modified or removed from node1a to node2
-#   * modified or added from node1b to node2
-# (except file added from node1a to node2 as they were not present in
-# node1a)
+#   * modified or removed from ctx1a to ctx2
+#   * modified or added from ctx1b to ctx2
+# (except file added from ctx1a to ctx2 as they were not present in
+# ctx1a)
 dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a)
-dir1a = snapshot(ui, repo, dir1a_files, node1a, tmproot, subrepos)[0]
-rev1a = b'@%d' % repo[node1a].rev()
+dir1a = snapshot(ui, repo, dir1a_files, ctx1a.node(), tmproot, subrepos)[0]
+rev1a = b'@%d' % ctx1a.rev()
 if do3way:
 # file calculation criteria same as dir1a
 dir1b_files = mod_b | rem_b | ((mod_a | add_a) - add_b)
-dir1b = snapshot(ui, repo, dir1b_files, node1b, tmproot, subrepos)[0]
-rev1b = b'@%d' % repo[node1b].rev()
+dir1b = snapshot(
+ui, repo, dir1b_files, ctx1b.node(), tmproot, subrepos
+)[0]
+rev1b = b'@%d' % ctx1b.rev()
 else:
 dir1b = None
 rev1b = b''
 
 fnsandstat = []
 
-# If node2 in not the wc or there is >1 change, copy it
+# If ctx2 is not the wc or there is >1 change, copy it
 dir2root = b''
 rev2 = b''
-if node2:
-dir2 = snapshot(ui, repo, modadd, node2, tmproot, subrepos)[0]
-rev2 = b'@%d' % repo[node2].rev()
+if ctx2.node() is not None:
+dir2 = snapshot(ui, repo, modadd, ctx2.node(), tmproot, subrepos)[0]
+rev2 = b'@%d' % ctx2.rev()
 elif len(common) > 1:
 # we only actually need to get the files to copy back to
 # the working dir in this case (because the other cases
@@ -563,36 +565,34 @@
 else:
 ctx1b = repo[nullid]
 
-node1a = ctx1a.node()
-node1b = ctx1b.node()
-node2 = ctx2.node()
-
 # Disable 3-way merge if there is only one parent
 if do3way:
-if node1b == nullid:
+if ctx1b.node() == nullid:
 do3way = False
 
-matcher = scmutil.match(repo[node2], pats, opts)
+matcher = scmutil.match(ctx2, pats, opts)
 
 if opts.get(b'patch'):
 if opts.get(b'subrepos'):
 raise error.Abort(_(b'--patch cannot be used with --subrepos'))
 if opts.get(b'per_file'):
 raise error.Abort(_(b'--patch cannot be used with --per-file'))
-if node2 is None:
+if ctx2.node() is None:
 raise error.Abort(_(b'--patch requires two revisions'))
 
 tmproot = pycompat.mkdtemp(prefix=b'extdiff.')
 try:
 if opts.get(b'patch'):
-return diffpatch(ui, repo, node1a, node2, tmproot, matcher, 
cmdline)
+return diffpatch(
+ui, repo, ctx1a.node(), ctx2.node(), tmproot, matcher, cmdline
+)
 
 return diffrevs(
 ui,
 repo,
-node1a,
-node1b,
-node2,
+ctx1a,
+ctx1b,
+ctx2,
 matcher,
 tmproot,
 cmdline,



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


D9621: tests: remove undefined (empty) $opt from test-extdiff.t

2020-12-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's been undefined for a long time (at least since .t unification).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-extdiff.t

CHANGE DETAILS

diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -11,7 +11,7 @@
 
 Should diff cloned directories:
 
-  $ hg extdiff -o -r $opt
+  $ hg extdiff -o -r
   Only in a: a
   Only in a: b
   [1]



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


D9620: mergetools: alphabetize the config settings

2020-12-16 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will make it easier to identify differences with the TortoiseHg config
  file.  It was simply piped through `sort`, and then the spacing and comments
  restored into the proper place.  The `UltraCompare` config was positioned such
  that the sort is case insensitive- it's the only camelcase config in here.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/defaultrc/mergetools.rc

CHANGE DETAILS

diff --git a/mercurial/defaultrc/mergetools.rc 
b/mercurial/defaultrc/mergetools.rc
--- a/mercurial/defaultrc/mergetools.rc
+++ b/mercurial/defaultrc/mergetools.rc
@@ -1,82 +1,55 @@
 # Some default global settings for common merge tools
 
 [merge-tools]
-kdiff3.args=--auto --L1 $labelbase --L2 $labellocal --L3 $labelother $base 
$local $other -o $output
-kdiff3.regkey=Software\KDiff3
-kdiff3.regkeyalt=Software\Wow6432Node\KDiff3
-kdiff3.regappend=\kdiff3.exe
-kdiff3.fixeol=True
-kdiff3.gui=True
-kdiff3.diffargs=--L1 $plabel1 --L2 $clabel $parent $child
+araxis.args=/3 /a2 /wait /merge /title1:"Other" /title2:"Base" /title3:"Local 
:"$local $other $base $local $output
+araxis.binary=True
+araxis.checkconflict=True
+araxis.diffargs=/2 /wait /title1:$plabel1 /title2:$clabel $parent $child
+araxis.gui=True
+araxis.priority=-2
+araxis.regappend=\ConsoleCompare.exe
+araxis.regkey=SOFTWARE\Classes\TypeLib\{46799e0a-7bd1-4330-911c-9660bb964ea2}\7.0\HELPDIR
 
-gvimdiff.args=--nofork -d -g -O $local $other $base
-gvimdiff.regkey=Software\Vim\GVim
-gvimdiff.regkeyalt=Software\Wow6432Node\Vim\GVim
-gvimdiff.regname=path
-gvimdiff.priority=-9
-gvimdiff.diffargs=--nofork -d -g -O $parent $child
-
-vimdiff.args=$local $other $base -c 'redraw | echomsg "hg merge conflict, type 
\":cq\" to abort vimdiff"'
-vimdiff.check=changed
-vimdiff.priority=-10
+; Linux version of Beyond Compare
+bcompare.args=$local $other $base -mergeoutput=$output -ro 
-lefttitle=$labellocal -centertitle=$labelbase -righttitle=$labelother 
-outputtitle=merged -automerge -reviewconflicts -solo
+bcompare.diffargs=-lro -lefttitle=$plabel1 -righttitle=$clabel -solo 
-expandall $parent $child
+bcompare.gui=True
+bcompare.priority=-1
 
-merge.check=conflicts
-merge.priority=-100
-
-gpyfm.gui=True
-
-meld.gui=True
-meld.args=--label=$labellocal $local --label='merged' $base 
--label=$labelother $other -o $output --auto-merge
-meld.check=changed
-meld.diffargs=-a --label=$plabel1 $parent --label=$clabel $child
+; OS X version of Beyond Compare
+bcomposx.args=$local $other $base -mergeoutput=$output -ro 
-lefttitle=$labellocal -centertitle=$labelbase -righttitle=$labelother 
-outputtitle=merged -automerge -reviewconflicts -solo
+bcomposx.diffargs=-lro -lefttitle=$plabel1 -righttitle=$clabel -solo 
-expandall $parent $child
+bcomposx.executable = /Applications/Beyond Compare.app/Contents/MacOS/bcomp
+bcomposx.gui=True
+bcomposx.priority=-1
 
-tkdiff.args=$local $other -a $base -o $output
-tkdiff.gui=True
-tkdiff.priority=-8
-tkdiff.diffargs=-L $plabel1 $parent -L $clabel $child
+; Windows version of Beyond Compare
+beyondcompare3.args=$local $other $base $output /ro /lefttitle=$labellocal 
/centertitle=$labelbase /righttitle=$labelother /automerge /reviewconflicts 
/solo
+beyondcompare3.diffargs=/lro /lefttitle=$plabel1 /righttitle=$clabel /solo 
/expandall $parent $child
+beyondcompare3.gui=True
+beyondcompare3.priority=-2
+beyondcompare3.regkey=Software\Scooter Software\Beyond Compare 3
+beyondcompare3.regname=ExePath
 
-xxdiff.args=--show-merged-pane --exit-with-merge-status --title1 $labellocal 
--title2 $labelbase --title3 $labelother --merged-filename $output --merge 
$local $base $other
-xxdiff.gui=True
-xxdiff.priority=-8
-xxdiff.diffargs=--title1 $plabel1 $parent --title2 $clabel $child
-
+diffmerge.args=-nosplash -merge -title1=$labellocal -title2=merged 
-title3=$labelother $local $base $other -result=$output
+diffmerge.check=changed
+diffmerge.diffargs=--nosplash --title1=$plabel1 --title2=$clabel $parent $child
+diffmerge.gui=True
+diffmerge.priority=-7
 diffmerge.regkey=Software\SourceGear\SourceGear DiffMerge\
 diffmerge.regkeyalt=Software\Wow6432Node\SourceGear\SourceGear DiffMerge\
 diffmerge.regname=Location
-diffmerge.priority=-7
-diffmerge.args=-nosplash -merge -title1=$labellocal -title2=merged 
-title3=$labelother $local $base $other -result=$output
-diffmerge.check=changed
-diffmerge.gui=True
-diffmerge.diffargs=--nosplash --title1=$plabel1 --title2=$clabel $parent $child
 
-p4merge.args=$base $local $other $output
-p4merge.regkey=Software\Perforce\Environment
-p4merge.regkeyalt=Software\Wow6432Node\Perforce\Environment
-p4merge.regname=P4INSTROOT
-p4merge.regappend=\p4merge.exe
-p4merge.gui=True
-p4merge.priority=-8
-p4merge.diffargs=$parent $child
-
-p4mergeosx.executable = 

[Bug 6457] New: Integrity Check Failed

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

Bug ID: 6457
   Summary: Integrity Check Failed
   Product: Mercurial
   Version: earlier
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: david.park...@baesystems.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

I was checking in a series of new files when Mercurial threw and error
(integrity check failed on 00changelog.i:1079). 
I have tried refreshing the repository but to no effect. 
It recommended that I file a bug report.

I am working from home and was checking files into a repository on a remote
server. Is there any way I can recover the repository?

Cheers dave-p

Bug report below:

#!python
** Mercurial version (2.7.2).  TortoiseHg version (2.9.2)
** Command: 
** CWD: C:\WINDOWS\system32
** Encoding: cp1252
** Extensions loaded: 
** Python version: 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64
bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=1, build=7601,
platform=2, service_pack='Service Pack 1')
** Processor architecture: x64
** Qt-4.8.4 PyQt-4.10.2 QScintilla-2.7.2
Traceback (most recent call last):
  File "tortoisehg\hgqt\workbench.pyo", line 683, in openRepo
  File "tortoisehg\hgqt\workbench.pyo", line 890, in addRepoTab
  File "tortoisehg\hgqt\repowidget.pyo", line 105, in __init__
  File "tortoisehg\hgqt\repowidget.pyo", line 157, in setupUi
  File "tortoisehg\hgqt\repofilter.pyo", line 172, in __init__
  File "tortoisehg\hgqt\repofilter.pyo", line 440, in refresh
  File "tortoisehg\hgqt\repofilter.pyo", line 388, in _updateBranchFilter
  File "mercurial\util.pyo", line 277, in __get__
  File "tortoisehg\hgqt\thgrepo.pyo", line 648, in namedbranches
  File "mercurial\localrepo.pyo", line 663, in branchtags
  File "mercurial\localrepo.pyo", line 640, in branchmap
  File "mercurial\branchmap.pyo", line 75, in updatecache
  File "mercurial\localrepo.pyo", line 640, in branchmap
  File "mercurial\branchmap.pyo", line 75, in updatecache
  File "mercurial\localrepo.pyo", line 640, in branchmap
  File "mercurial\branchmap.pyo", line 75, in updatecache
  File "mercurial\localrepo.pyo", line 640, in branchmap
  File "mercurial\branchmap.pyo", line 80, in updatecache
  File "mercurial\branchmap.pyo", line 156, in update
  File "mercurial\changelog.pyo", line 349, in branch
  File "mercurial\changelog.pyo", line 282, in read
  File "mercurial\revlog.pyo", line 939, in revision
  File "mercurial\revlog.pyo", line 948, in _checkhash
RevlogError: integrity check failed on 00changelog.i:1079

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


D9617: debugupgraderepo: minor documentation fix

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

REVISION SUMMARY
  When we specify `--no-changelog --no-manifest --no-filelog` we skip all revlog
  optimization instead of all filelog optimization.
  
  Also while I was here, for consistency, I did `optimisation` -> `optimization`
  to make it consistent with rest of occurrences.
  Note: I am not native speaker and I only changed it because of consistency. I
  don't know which one is correct.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -3922,7 +3922,7 @@
   * `--changelog`: optimize the changelog only
   * `--no-changelog --no-manifest`: optimize filelogs only
   * `--filelogs`: optimize the filelogs only
-  * `--no-changelog --no-manifest --no-filelogs`: skip all filelog 
optimisation
+  * `--no-changelog --no-manifest --no-filelogs`: skip all revlog 
optimizations
 """
 return upgrade.upgraderepo(
 ui, repo, run=run, optimize=set(optimize), backup=backup, **opts



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


D9614: upgrade: drop support for old style optimization names

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

REVISION SUMMARY
  Old style optimization names like `redeltaparent` were converted into
  `re-delta-parent` more than two years ago. The old names were kept around for
  sometime because of BC reasons.
  
  Refer 5608b5a6c3231c4ec771171cc3079142c7672be6 
. 
The commit states the map is
  there for a while and we can drop them as the underlying command is a debug
  command.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  mercurial/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
@@ -211,7 +211,7 @@
 
 --optimize can be used to add optimizations
 
-  $ hg debugupgrade --optimize redeltaparent
+  $ hg debugupgrade --optimize 're-delta-parent'
   (no format upgrades found in existing repository)
   performing an upgrade with "--run" will make the following changes:
   
@@ -1060,7 +1060,7 @@
   removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
   copy of old repository backed up at 
$TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
   the old repository will not be deleted; remove it to free up disk space once 
the upgraded repository is verified
-  $ hg debugupgraderepo --run --optimize redeltafulladd
+  $ hg debugupgraderepo --run --optimize 're-delta-fulladd'
   upgrade will perform the following actions:
   
   requirements
@@ -1289,7 +1289,7 @@
 1   120  p1 21191 98   
0.5130998 00.0 98 98   1.01
 2   120   other 30200107   
0.53500   128210.19626128128   0.835941
 
-  $ hg debugupgraderepo --run --optimize redeltaall
+  $ hg debugupgraderepo --run --optimize 're-delta-all'
   upgrade will perform the following actions:
   
   requirements
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -22,19 +22,6 @@
 
 allformatvariant = upgrade_actions.allformatvariant
 
-# search without '-' to support older form on newer client.
-#
-# We don't enforce backward compatibility for debug command so this
-# might eventually be dropped. However, having to use two different
-# forms in script when comparing result is anoying enough to add
-# backward compatibility for a while.
-legacy_opts_map = {
-b'redeltaparent': b're-delta-parent',
-b'redeltamultibase': b're-delta-multibase',
-b'redeltaall': b're-delta-all',
-b'redeltafulladd': b're-delta-fulladd',
-}
-
 
 def upgraderepo(
 ui,
@@ -48,8 +35,7 @@
 ):
 """Upgrade a repository in place."""
 if optimize is None:
-optimize = []
-optimize = {legacy_opts_map.get(o, o) for o in optimize}
+optimize = {}
 repo = repo.unfiltered()
 
 revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3925,7 +3925,7 @@
   * `--no-changelog --no-manifest --no-filelogs`: skip all filelog 
optimisation
 """
 return upgrade.upgraderepo(
-ui, repo, run=run, optimize=optimize, backup=backup, **opts
+ui, repo, run=run, optimize=set(optimize), backup=backup, **opts
 )
 
 



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


D9619: upgrade: introduce post upgrade and downgrade message for improvements

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

REVISION SUMMARY
  For certain imporvements, we will like to show a message after the operation
  completed. This patch introduces that functionality.
  
  Right now it's only used by share-safe feature.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade.py
  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
@@ -57,6 +57,14 @@
 upgrademessage
Message intended for humans explaining what an upgrade addressing this
issue will do. Should be worded in the future tense.
+
+postupgrademessage
+   Message intended for humans which will be shown post and upgrade
+   operationupgrade when the improvement will be added
+
+postdowngrademessage
+   Message intended for humans which will be shown post an upgrade
+   operation in which this improvement was removed
 """
 
 def __init__(self, name, type, description, upgrademessage):
@@ -64,6 +72,8 @@
 self.type = type
 self.description = description
 self.upgrademessage = upgrademessage
+self.postupgrademessage = None
+self.postdowngrademessage = None
 
 def __eq__(self, other):
 if not isinstance(other, improvement):
@@ -109,6 +119,14 @@
 # value of current Mercurial default for new repository
 default = None
 
+# Message intended for humans which will be shown post and upgrade
+# operationupgrade when the improvement will be added
+postupgrademessage = None
+
+# Message intended for humans which will be shown post an upgrade
+# operation in which this improvement was removed
+postdowngrademessage = None
+
 def __init__(self):
 raise NotImplementedError()
 
@@ -235,6 +253,19 @@
 b'shares of this repository share its requirements and configs.'
 )
 
+postdowngrademessage = _(
+b'repository downgraded to not use share safe mode, '
+b'existing shares will not work and needs to'
+b' be reshared.'
+)
+
+postupgrademessage = _(
+b'repository upgraded to share safe mode, existing'
+b' shares will still work in old non-safe mode. '
+b'Re-share existing shares to use them in safe mode'
+b' New shares will be created in safe mode.'
+)
+
 
 @registerformatvariant
 class sparserevlog(requirementformatvariant):
@@ -585,6 +616,7 @@
 new_requirements,
 current_requirements,
 upgrade_actions,
+removed_actions,
 revlogs_to_process,
 ):
 self.ui = ui
@@ -593,6 +625,7 @@
 # list of upgrae actions the operation will perform
 self.upgrade_actions = upgrade_actions
 self._upgrade_actions_names = set([a.name for a in upgrade_actions])
+self.removed_actions = removed_actions
 self.revlogs_to_process = revlogs_to_process
 # requirements which will be added by the operation
 self.added_requirements = (
@@ -679,6 +712,15 @@
 """ Check whether the upgrade operation will perform this action """
 return name in self._upgrade_actions_names
 
+def print_post_op_messages(self):
+""" print post upgrade operation warning messages """
+for a in self.upgrade_actions:
+if a.postupgrademessage is not None:
+self.ui.warn(b'%s\n' % a.postupgrademessage)
+for a in self.removed_actions:
+if a.postdowngrademessage is not None:
+self.ui.warn(b'%s\n' % a.postdowngrademessage)
+
 
 ###  Code checking if a repository can got through the upgrade process at all. 
#
 
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -87,6 +87,7 @@
 up_actions = upgrade_actions.determine_upgrade_actions(
 repo, format_upgrades, optimizations, repo.requirements, newreqs
 )
+removed_actions = upgrade_actions.find_format_downgrades(repo)
 
 removedreqs = repo.requirements - newreqs
 addedreqs = newreqs - repo.requirements
@@ -108,6 +109,7 @@
 newreqs,
 repo.requirements,
 up_actions,
+removed_actions,
 revlogs,
 )
 
@@ -226,20 +228,4 @@
 )
 )
 
-if upgrade_actions.sharesafe.name in addedreqs:
-ui.warn(
-_(
-b'repository upgraded to share safe mode, existing'
-b' shares will still work in old non-safe mode. '
-b'Re-share existing shares to use them in safe mode'
-b' New shares will be created in safe mode.\n'
-)
-  

D9618: actions: introduce function to calculate downgrades

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

REVISION SUMMARY
  An ugrade operation can also downgrade/remove some format variants. Before 
this
  patch there was no clean way to find out all such variants which will be
  removed. This patch adds a function for that.
  
  It will be used in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -428,6 +428,21 @@
 return upgrades
 
 
+def find_format_downgrades(repo):
+"""returns a list of format downgrades which will be performed on the repo
+because of disabled config option for them"""
+
+downgrades = []
+
+for fv in allformatvariant:
+# format variant exist in repo but does not exist in new repository
+# config
+if fv.fromrepo(repo) and not fv.fromconfig(repo):
+downgrades.append(fv)
+
+return downgrades
+
+
 ALL_OPTIMISATIONS = []
 
 



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


D9616: upgrade: rename actions to upgrade_actions

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

REVISION SUMMARY
  The `actions` were a list of optimizations and format ugrades which will be
  upgraded. This does not include things which will be downgraded.
  
  Let's rename the variable for clarity. It now makes obvious that we don't have
  any concrete information on what things are downgraded.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade.py
  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
@@ -410,13 +410,13 @@
 )
 )
 
-if upgrade_op.has_action(b're-delta-all'):
+if upgrade_op.has_upgrade_action(b're-delta-all'):
 deltareuse = revlog.revlog.DELTAREUSENEVER
-elif upgrade_op.has_action(b're-delta-parent'):
+elif upgrade_op.has_upgrade_action(b're-delta-parent'):
 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-elif upgrade_op.has_action(b're-delta-multibase'):
+elif upgrade_op.has_upgrade_action(b're-delta-multibase'):
 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
-elif upgrade_op.has_action(b're-delta-fulladd'):
+elif upgrade_op.has_upgrade_action(b're-delta-fulladd'):
 deltareuse = revlog.revlog.DELTAREUSEFULLADD
 else:
 deltareuse = revlog.revlog.DELTAREUSEALWAYS
@@ -428,7 +428,7 @@
 dstrepo,
 tr,
 deltareuse,
-upgrade_op.has_action(b're-delta-multibase'),
+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
@@ -526,7 +526,7 @@
 return list(ALL_OPTIMISATIONS)
 
 
-def determineactions(
+def determine_upgrade_actions(
 repo, format_upgrades, optimizations, sourcereqs, destreqs
 ):
 """Determine upgrade actions that will be performed.
@@ -569,14 +569,15 @@
 ui,
 new_requirements,
 current_requirements,
-actions,
+upgrade_actions,
 revlogs_to_process,
 ):
 self.ui = ui
 self.new_requirements = new_requirements
 self.current_requirements = current_requirements
-self.actions = actions
-self._actions_names = set([a.name for a in actions])
+# list of upgrae actions the operation will perform
+self.upgrade_actions = upgrade_actions
+self._upgrade_actions_names = set([a.name for a in upgrade_actions])
 self.revlogs_to_process = revlogs_to_process
 # requirements which will be added by the operation
 self.added_requirements = (
@@ -594,7 +595,7 @@
 # should use them
 all_optimizations = findoptimizations(None)
 self.unused_optimizations = [
-i for i in all_optimizations if i not in self.actions
+i for i in all_optimizations if i not in self.upgrade_actions
 ]
 
 def _write_labeled(self, l, label):
@@ -630,7 +631,9 @@
 self.ui.write(b'\n')
 
 def print_optimisations(self):
-optimisations = [a for a in self.actions if a.type == OPTIMISATION]
+optimisations = [
+a for a in self.upgrade_actions if a.type == OPTIMISATION
+]
 optimisations.sort(key=lambda a: a.name)
 if optimisations:
 self.ui.write(_(b'optimisations: '))
@@ -641,7 +644,7 @@
 self.ui.write(b'\n\n')
 
 def print_upgrade_actions(self):
-for a in self.actions:
+for a in self.upgrade_actions:
 self.ui.status(b'%s\n   %s\n\n' % (a.name, a.upgrademessage))
 
 def print_affected_revlogs(self):
@@ -657,9 +660,9 @@
 for i in self.unused_optimizations:
 self.ui.status(_(b'%s\n   %s\n\n') % (i.name, i.description))
 
-def has_action(self, name):
+def has_upgrade_action(self, name):
 """ Check whether the upgrade operation will perform this action """
-return name in self._actions_names
+return name in self._upgrade_actions_names
 
 
 ###  Code checking if a repository can got through the upgrade process at all. 
#
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -84,7 +84,7 @@
 )
 
 format_upgrades = upgrade_actions.find_format_upgrades(repo)
-actions = upgrade_actions.determineactions(
+up_actions = upgrade_actions.determine_upgrade_actions(
 repo, format_upgrades, optimizations, repo.requirements, newreqs
 )
 
@@ -107,7 +107,7 @@
 ui,
 newreqs,
 repo.requirements,
-

D9615: upgrade: move optimization addition to determineactions()

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

REVISION SUMMARY
  The documentation of `determineactions()` mention that it is given a list
  returned from `findoptimizations()` however it was not true before this patch.
  
  The code extending actions with optimizations also mentioned about it that 
this
  should be in determineactions.
  
  So let's do what comments at couple of places say.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/upgrade.py
  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
@@ -526,7 +526,9 @@
 return list(ALL_OPTIMISATIONS)
 
 
-def determineactions(repo, format_upgrades, sourcereqs, destreqs):
+def determineactions(
+repo, format_upgrades, optimizations, sourcereqs, destreqs
+):
 """Determine upgrade actions that will be performed.
 
 Given a list of improvements as returned by ``find_format_upgrades`` and
@@ -551,6 +553,8 @@
 
 newactions.append(d)
 
+newactions.extend(o for o in sorted(optimizations) if o not in newactions)
+
 # FUTURE consider adding some optimizations here for certain transitions.
 # e.g. adding generaldelta could schedule parent redeltas.
 
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -85,13 +85,7 @@
 
 format_upgrades = upgrade_actions.find_format_upgrades(repo)
 actions = upgrade_actions.determineactions(
-repo, format_upgrades, repo.requirements, newreqs
-)
-actions.extend(
-o
-for o in sorted(optimizations)
-# determineactions could have added optimisation
-if o not in actions
+repo, format_upgrades, optimizations, repo.requirements, newreqs
 )
 
 removedreqs = repo.requirements - newreqs



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