[PATCH] patchcopies: backout and optimisation that backfired

2019-10-03 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1570072771 14400
#  Wed Oct 02 23:19:31 2019 -0400
# Node ID 07010e0cae5cab2ff0c375f24c1d8185ead8e957
# Parent  03e769278ef31f648ba5c49be719da5b73587607
# EXP-Topic patchcopies-regression
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
07010e0cae5c
patchcopies: backout and optimisation that backfired

In 8a0136f69027 we introduced a new "introrev" function. And in d98fb3f42f33, we
made it smart enough to speedup various pathological case.

However, it turns out that is can also introduce massive slow down in some other
cases. To clarify the situation, I ran `perfpathcopies` on 6989 pair of revision
in the pypy repository (`hg perfhelper-pathcopies`. The result is massively in 
favor of dropping this
condition:

Here are various numbers (before this changeset/after this changesets)

source   destination  before  afterabs-timeratio
worth cases 0c90acafea5d 7a260b2c45111.251143 1.775874   -0.524731 1.419401
795743bd02b0 daa08b2d951c1.276092 1.722316   -0.446224 1.349680
d7b4ace71d7e a4fedb1664ee1.046802 1.491993   -0.445191 1.425287
464d641a9035 4d87b3d82dc21.072234 1.509769   -0.437535 1.408059
a305590465d6 a84f8ceb87401.322278 1.738900   -0.416622 1.315079
worse  1%   dbfbfcf077e9 89183b3a84f31.471880 1.735137   -0.263257 1.178858
worth  5%   688a132b06b6 573e529840d70.090268 0.118713   -0.028445 1.315117
worth 10%   0bfaff4207c3 dca96cba7aee1.790686 1.795441   -0.004755 1.002655
worth 25%   e99ce6af254c a7dedcc55d550.001954 0.002108   -0.000154 1.078813
median  9e7c5b33e755 c6c97bf468460.001925 0.0019010.24 0.987532
best 25%3f055112fae9 df1447de24d70.002923 0.0021630.000760 0.739993
best 10%da67e5b7be9e f2d3714715880.473663 0.4413570.032306 0.931795
best  5%b02f6ce0d05b 9b4bd629bb441.664841 1.4273230.237518 0.857333
best  1%73ea83bf410b ed910c5221d93.005100 0.1389982.866102 0.046254
best cases  80b492d79663 1456861b1ea6 1464.845562 3.942297 1460.903265 0.002691
ace7255d9a26 682589af6612 1594.849940 2.467435 1592.382505 0.001547
c3b14617fbd7 743a0fcaa4eb 1618.130257 2.636641 1615.493616 0.001629
c3b14617fbd7 9ba6ab77fd29 1621.882135 2.670315 1619.211820 0.001646
ef865da04745 421ca854cd86 1631.803875 2.646586 1629.157289 0.001622


As one can see, the average case is not really impacted. However, the worth case
we get after this changeset are much better than the one we had before it. We
have 30 pairs where improvement is > 10 minutes.


This reflect in the combined time for all pairs
before: 37700s
after:   1898s (-95%)

If we remove these last 30 case, we still see a significant improvements:

before: 2347s
after:  1898s (-20%)

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -160,8 +160,6 @@ def _tracefile(fctx, am, basemf, limit):
 return path
 if basemf and basemf.get(path, None) == f.filenode():
 return path
-if not f.isintroducedafter(limit):
-return None
 
 def _dirstatecopies(repo, match=None):
 ds = repo.dirstate
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6923: setup: build extensions in parallel by default

2019-10-03 Thread indygreg (Gregory Szorc)
Closed by commit rHGf9d35f01b8b3: setup: build extensions in parallel by 
default (authored by indygreg).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6923?vs=16715=16790

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

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

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -490,6 +490,14 @@
 
 return build_ext.initialize_options(self)
 
+def finalize_options(self):
+# Unless overridden by the end user, build extensions in parallel.
+# Only influences behavior on Python 3.5+.
+if getattr(self, 'parallel', None) is None:
+self.parallel = True
+
+return build_ext.finalize_options(self)
+
 def build_extensions(self):
 ruststandalones = [e for e in self.extensions
if isinstance(e, RustStandaloneExtension)]



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


D6957: rebase: unconditionally clear merge state when `--stop`ing a rebase

2019-10-03 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I am NOT sure of the correctness of this change, but I've hit a point
  on a work repository where the needupdate function returns false and
  so the merge state never gets correctly cleared. As far as I can tell
  when we're *always* in a merge state at this point, so we should
  *always* clear the merge state.
  
  I'm not sure how to structure the test at the moment, but if others
  agree that this looks plausible I'll try and figure out what state my
  work repository is in to craft a test case that can be used to prevent
  any backsliding on this fix.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -909,10 +909,9 @@
 hint=_('either enable obsmarkers to allow unstable '
'revisions or use --keep to keep original '
'changesets'))
-if needupdate(repo, rbsrt.state):
-# update to the current working revision
-# to clear interrupted merge
-hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
+# update to the current working revision
+# to clear interrupted merge
+hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
 rbsrt._finishrebase()
 return 0
 elif inmemory:



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


mercurial@43042: 10 new changesets

2019-10-03 Thread Mercurial Commits
10 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/21025a4107d4
changeset:   43033:21025a4107d4
user:Pierre-Yves David 
date:Mon Sep 09 14:03:12 2019 +0200
summary: sidedata: add a new module with basic documentation

https://www.mercurial-scm.org/repo/hg/rev/294afb982a88
changeset:   43034:294afb982a88
user:Pierre-Yves David 
date:Wed Sep 04 00:59:15 2019 +0200
summary: sidedata: add a function to read sidedata from revlog raw text

https://www.mercurial-scm.org/repo/hg/rev/ea83abf95630
changeset:   43035:ea83abf95630
user:Pierre-Yves David 
date:Wed Sep 04 01:20:54 2019 +0200
summary: sidedata: add a function to write sidedata into a raw text

https://www.mercurial-scm.org/repo/hg/rev/e8bc4c3d9a0b
changeset:   43036:e8bc4c3d9a0b
user:Pierre-Yves David 
date:Wed Sep 04 03:19:58 2019 +0200
summary: sidedata: add a function for _processflagsraw usage

https://www.mercurial-scm.org/repo/hg/rev/142deb539ccf
changeset:   43037:142deb539ccf
user:Pierre-Yves David 
date:Wed Sep 04 03:20:55 2019 +0200
summary: sidedata: register the flag processors if the repository allows 
for it

https://www.mercurial-scm.org/repo/hg/rev/7bb5a2465501
changeset:   43038:7bb5a2465501
user:Pierre-Yves David 
date:Tue Sep 03 23:45:38 2019 +0200
summary: revlog: add the appropriate flag is sidedata are passed to 
`addrevision`

https://www.mercurial-scm.org/repo/hg/rev/7902001aaf41
changeset:   43039:7902001aaf41
user:Pierre-Yves David 
date:Fri Sep 27 16:40:07 2019 +0200
summary: sidedata: make sure we don't use the flag if there are not sidedata

https://www.mercurial-scm.org/repo/hg/rev/ba4072c0a911
changeset:   43040:ba4072c0a911
user:Pierre-Yves David 
date:Mon Sep 09 21:38:29 2019 +0200
summary: sidedata: test we can successfully write sidedata

https://www.mercurial-scm.org/repo/hg/rev/559ac8411f12
changeset:   43041:559ac8411f12
user:Pierre-Yves David 
date:Tue Sep 10 00:15:47 2019 +0200
summary: sidedata: add a debugsidedata command

https://www.mercurial-scm.org/repo/hg/rev/03e769278ef3
changeset:   43042:03e769278ef3
bookmark:@
tag: tip
user:Pierre-Yves David 
date:Tue Sep 10 00:30:53 2019 +0200
summary: sidedata: check that the sidedata safely roundtrip

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


D6890: sidedata: add a function to read sidedata from revlog raw text

2019-10-03 Thread indygreg (Gregory Szorc)
indygreg added inline comments.

INLINE COMMENTS

> sidedata.py:42
> +SIDEDATA_HEADER = struct.Struct('>H')
> +SIDEDATA_ENTRY = struct.Struct('>HL20s')
> +

Python 3 will require a `r''` because of source transformation.

REPOSITORY
  rHG Mercurial

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

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

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


mercurial@43032: 3 new changesets

2019-10-03 Thread Mercurial Commits
3 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/827cb4fe62a3
changeset:   43030:827cb4fe62a3
parent:  43027:041f042afcc5
user:Pierre-Yves David 
date:Mon Sep 09 22:42:55 2019 +0200
summary: sidedata: introduce a new requirement to protect the feature

https://www.mercurial-scm.org/repo/hg/rev/e16ca9fde7aa
changeset:   43031:e16ca9fde7aa
user:Pierre-Yves David 
date:Wed Sep 04 02:43:17 2019 +0200
summary: upgrade: detect the side-data format variants

https://www.mercurial-scm.org/repo/hg/rev/a12a9af7536c
changeset:   43032:a12a9af7536c
bookmark:@
tag: tip
user:Pierre-Yves David 
date:Wed Aug 07 17:55:44 2019 +0200
summary: sidedata: add a new revision flag constant for side data

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


D6956: unfinishedstate: suggested `hg update .` (including `.`) to complete update

2019-10-03 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `hg update` can update to a different and undesired commit. For users
  who have commands.update.requiredest=yes, it's even an error to run
  just `hg update.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/state.py
  tests/test-merge1.t

CHANGE DETAILS

diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -49,7 +49,7 @@
   ? b/nonempty
   # The repository is in an unfinished *update* state.
   
-  # To continue:hg update
+  # To continue:hg update .
   
 
   $ rm b/nonempty
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -201,7 +201,7 @@
 'update', fname='updatestate', clearable=True,
 cmdmsg=_('last update was interrupted'),
 cmdhint=_("use 'hg update' to get a consistent checkout"),
-statushint=_("To continue:hg update")
+statushint=_("To continue:hg update .")
 )
 addunfinished(
 'bisect', fname='bisect.state', allowcommit=True, reportonly=True,



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


D6954: sidedatacopies: move various copies related function to the copies modules

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We will need to access these logic form the copies module. So we move them 
from
  their higher level module to the lower level `copies` module. We cannot use 
them
  from their top level module as it would create cycles.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -2003,21 +2003,3 @@
  "ancestors(head() and not bookmark(%s)) - "
  "ancestors(bookmark() and not bookmark(%s))",
  mark, mark, mark)
-
-def computechangesetfilesadded(ctx):
-"""return the list of files added in a changeset
-"""
-added = []
-for f in ctx.files():
-if not any(f in p for p in ctx.parents()):
-added.append(f)
-return added
-
-def computechangesetfilesremoved(ctx):
-"""return the list of files removed in a changeset
-"""
-removed = []
-for f in ctx.files():
-if f not in ctx:
-removed.append(f)
-return removed
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -14,6 +14,7 @@
 from .i18n import _
 
 from . import (
+error,
 match as matchmod,
 node,
 pathutil,
@@ -813,6 +814,25 @@
 if dst in wctx:
 wctx[dst].markcopied(src)
 
+
+def computechangesetfilesadded(ctx):
+"""return the list of files added in a changeset
+"""
+added = []
+for f in ctx.files():
+if not any(f in p for p in ctx.parents()):
+added.append(f)
+return added
+
+def computechangesetfilesremoved(ctx):
+"""return the list of files removed in a changeset
+"""
+removed = []
+for f in ctx.files():
+if f not in ctx:
+removed.append(f)
+return removed
+
 def computechangesetcopies(ctx):
 """return the copies data for a changeset
 
@@ -837,3 +857,52 @@
 elif src in p2 and p2[src].filenode() == srcnode:
 p2copies[dst] = src
 return p1copies, p2copies
+
+def encodecopies(files, copies):
+items = []
+for i, dst in enumerate(files):
+if dst in copies:
+items.append('%d\0%s' % (i, copies[dst]))
+if len(items) != len(copies):
+raise error.ProgrammingError('some copy targets missing from file 
list')
+return "\n".join(items)
+
+def decodecopies(files, data):
+try:
+copies = {}
+if not data:
+return copies
+for l in data.split('\n'):
+strindex, src = l.split('\0')
+i = int(strindex)
+dst = files[i]
+copies[dst] = src
+return copies
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "p1copies") and
+# used different syntax for the value.
+return None
+
+def encodefileindices(files, subset):
+subset = set(subset)
+indices = []
+for i, f in enumerate(files):
+if f in subset:
+indices.append('%d' % i)
+return '\n'.join(indices)
+
+def decodefileindices(files, data):
+try:
+subset = []
+if not data:
+return subset
+for strindex in data.split('\n'):
+i = int(strindex)
+if i < 0 or i >= len(files):
+return None
+subset.append(files[i])
+return subset
+except (ValueError, IndexError):
+# Perhaps someone had chosen the same key name (e.g. "added") and
+# used different syntax for the value.
+return None
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -466,9 +466,9 @@
 filesadded = []
 elif source == 'compatibility':
 if filesadded is None:
-filesadded = scmutil.computechangesetfilesadded(self)
+filesadded = copies.computechangesetfilesadded(self)
 else:
-filesadded = scmutil.computechangesetfilesadded(self)
+filesadded = copies.computechangesetfilesadded(self)
 return filesadded
 
 def filesremoved(self):
@@ -483,9 +483,9 @@
 filesremoved = []
 elif source == 'compatibility':
 if filesremoved is None:
-filesremoved = scmutil.computechangesetfilesremoved(self)
+filesremoved = copies.computechangesetfilesremoved(self)
 else:
-filesremoved = scmutil.computechangesetfilesremoved(self)
+filesremoved = copies.computechangesetfilesremoved(self)
 

D6953: sidedatacopies: read rename information from sidedata

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Repository using the new format now use changeset centric algorithm and read 
the
  copies information from the changelog sidedata.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/context.py
  mercurial/copies.py
  tests/test-copies-unrelated.t
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -309,7 +309,6 @@
   x -> z
   $ hg debugpathcopies 0 2
   x -> z (filelog !)
-  x -> z (sidedata !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -338,12 +337,14 @@
  x
   $ hg debugp1copies -r 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugp2copies -r 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
   $ hg debugpathcopies 1 2
   x -> z (changeset !)
+  x -> z (sidedata !)
   $ hg debugpathcopies 0 2
-  x -> z (no-changeset !)
+  x -> z (no-changeset no-sidedata !)
 
 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies 
from one parent
 of the merge to the merge should include the copy from the other side.
@@ -403,7 +404,7 @@
   $ hg debugpathcopies 2 3
   y -> z
   $ hg debugpathcopies 1 3
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
 
 Create x and y, then rename x to z on one side of merge, and rename y to z and
 modify z on the other side. When storing copies in the changeset, we don't
@@ -448,18 +449,18 @@
   o  0 add x and y
  x y
   $ hg debugpathcopies 1 4
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 4
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 4
   x -> z (filelog !)
-  x -> z (sidedata !)
+  y -> z (sidedata !)
   y -> z (compatibility !)
   y -> z (changeset !)
   $ hg debugpathcopies 1 5
-  y -> z (no-filelog no-sidedata !)
+  y -> z (no-filelog !)
   $ hg debugpathcopies 2 5
-  x -> z (no-filelog no-sidedata !)
+  x -> z (no-filelog !)
   $ hg debugpathcopies 0 5
   x -> z
 
diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t
--- a/tests/test-copies-unrelated.t
+++ b/tests/test-copies-unrelated.t
@@ -179,8 +179,8 @@
   o  0 add x
  x
   $ hg debugpathcopies 0 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x again" (glob)
   merging y and x to y
@@ -347,8 +347,8 @@
   o  0 base
  a
   $ hg debugpathcopies 1 5
-  x -> y (no-filelog no-sidedata !)
-#if no-filelog no-sidedata
+  x -> y (no-filelog !)
+#if no-filelog
   $ hg graft -r 2
   grafting 2:* "modify x" (glob)
   merging y and x to y
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -182,6 +182,8 @@
 
 def usechangesetcentricalgo(repo):
 """Checks if we should use changeset-centric copy algorithms"""
+if repo.filecopiesmode == 'changeset-sidedata':
+return True
 readfrom = repo.ui.config('experimental', 'copies.read-from')
 changesetsource = ('changeset-only', 'compatibility')
 return readfrom in changesetsource
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -456,7 +456,10 @@
 
 def filesadded(self):
 filesadded = self._changeset.filesadded
-if True:
+if self._repo.filecopiesmode == 'changeset-sidedata':
+if filesadded is None:
+filesadded = []
+else:
 source = self._repo.ui.config('experimental', 'copies.read-from')
 if source == 'changeset-only':
 if filesadded is None:
@@ -470,7 +473,10 @@
 
 def filesremoved(self):
 filesremoved = self._changeset.filesremoved
-if True:
+if self._repo.filecopiesmode == 'changeset-sidedata':
+if filesremoved is None:
+filesremoved = []
+else:
 source = self._repo.ui.config('experimental', 'copies.read-from')
 if source == 'changeset-only':
 if filesremoved is None:
@@ -486,7 +492,12 @@
 def _copies(self):
 p1copies = self._changeset.p1copies
 p2copies = self._changeset.p2copies
-if True:
+if self._repo.filecopiesmode == 'changeset-sidedata':
+if p1copies is None:
+p1copies = {}
+if p2copies is None:
+p2copies = {}
+else:
 source = self._repo.ui.config('experimental', 'copies.read-from')
 # If config says to get copy metadata only from changeset, then
 # return that, defaulting to {} if there was no copy metadata.  In
diff --git a/mercurial/changelog.py 

D6955: sidedatacopies: deal with upgrading and downgrading to that format

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is quite useful to test this on real life data.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/copies.py
  mercurial/upgrade.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -450,4 +450,91 @@
   $ hg ci -Aqm 'add a'
   $ hg mv a b
   $ hg ci -m 'remove a' a
+
+#if sidedata
+
+Test upgrading/downgrading to sidedata storage
+==
+
+downgrading (keeping some sidedata)
+
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 1
+   entry-0013 size 0
+  $ hg debugsidedata -c -- 1
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 0
+   entry-0013 size 1
+  $ hg debugsidedata -m -- 0
+  $ cat << EOF > .hg/hgrc
+  > [format]
+  > use-side-data = yes
+  > exp-use-copies-side-data-changeset = no
+  > EOF
+  $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc: no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  $ hg debugsidedata -c -- 1
+  $ hg debugsidedata -m -- 0
+
+upgrading
+
+  $ cat << EOF > .hg/hgrc
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+  $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+  $ hg debugsidedata -c -- 0
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 1
+   entry-0013 size 0
+  $ hg debugsidedata -c -- 1
+  4 sidedata entries
+   entry-0010 size 0
+   entry-0011 size 0
+   entry-0012 size 0
+   entry-0013 size 1
+  $ hg debugsidedata -m -- 0
+
+#endif
+
   $ cd ..
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -12,6 +12,7 @@
 from .i18n import _
 from . import (
 changelog,
+copies,
 error,
 filelog,
 hg,
@@ -32,7 +33,6 @@
 RECLONES_REQUIREMENTS = {
 'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
-localrepo.SIDEDATA_REQUIREMENT,
 }
 
 def requiredsourcerequirements(repo):
@@ -75,6 +75,7 @@
 supported = {
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -100,6 +101,7 @@
 'store',
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -125,6 +127,7 @@
 'generaldelta',
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
+localrepo.COPIESSDC_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -612,12 +615,17 @@
 def getsidedatacompanion(srcrepo, dstrepo):
 sidedatacompanion = None
 removedreqs = srcrepo.requirements - dstrepo.requirements
+addedreqs = dstrepo.requirements - srcrepo.requirements
 if localrepo.SIDEDATA_REQUIREMENT in removedreqs:
 def sidedatacompanion(rl, rev):
 rl = getattr(rl, '_revlog', rl)
 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
 return True, (), {}
 return False, (), {}
+elif localrepo.COPIESSDC_REQUIREMENT in addedreqs:
+sidedatacompanion = 

D6950: sidedatacopies: write copies information in sidedata when applicable

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If the format of the repository indicate it stores copies information into
  changeset's sidedata, then we actually write that information into sidedata at
  commit time. It will be put to use in later changesets.
  
  Currently, we store all field unconditionally, but that is likely to change in
  the future for the sake of efficiency.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/interfaces/repository.py
  mercurial/localrepo.py
  mercurial/revlogutils/sidedata.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -75,7 +75,17 @@
   p1copies: 0\x00a (esc)
   1\x00a (esc)
   2\x00a (esc)
-
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 11
+'0\x00a\n1\x00a\n2\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 5
+'0\n1\n2'
+   entry-0013 size 0
+''
 #endif
 
   $ hg showcopies
@@ -107,6 +117,17 @@
   
   p1copies: 1\x00b (esc)
 
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'1\x00b'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'1'
+   entry-0013 size 1
+'0'
 #endif
 
   $ hg showcopies
@@ -145,6 +166,17 @@
   
   p1copies: 0\x00b2 (esc)
 
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 4
+'0\x00b2'
+   entry-0011 size 0
+''
+   entry-0012 size 0
+''
+   entry-0013 size 0
+''
 #endif
 
   $ hg showcopies
@@ -197,6 +229,17 @@
   2\x00f (esc)
   p2copies: 1\x00d (esc)
 
+#else
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 7
+'0\x00a\n2\x00f'
+   entry-0011 size 3
+'1\x00d'
+   entry-0012 size 5
+'0\n1\n2'
+   entry-0013 size 0
+''
 #endif
 
   $ hg showcopies
@@ -218,6 +261,16 @@
   p2copies: 
 #else
   $ hg ci -m 'copy a to j'
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'0\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'0'
+   entry-0013 size 0
+''
 #endif
   $ hg debugdata j 0
   \x01 (esc)
@@ -243,6 +296,16 @@
 #else
   $ hg ci --amend -m 'copy a to j, v2'
   saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'0\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'0'
+   entry-0013 size 0
+''
 #endif
   $ hg showcopies --config experimental.copies.read-from=filelog-only
   a -> j
@@ -260,6 +323,16 @@
   p2copies: 
 #else
   $ hg ci -m 'modify j'
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 0
+''
+   entry-0011 size 0
+''
+   entry-0012 size 0
+''
+   entry-0013 size 0
+''
 #endif
 
 Test writing only to filelog
@@ -273,6 +346,16 @@
   
 #else
   $ hg ci -m 'copy a to k'
+  $ hg debugsidedata -c -v -- -1
+  4 sidedata entries
+   entry-0010 size 3
+'0\x00a'
+   entry-0011 size 0
+''
+   entry-0012 size 1
+'0'
+   entry-0013 size 0
+''
 #endif
 
   $ hg debugdata k 0
diff --git a/mercurial/revlogutils/sidedata.py 
b/mercurial/revlogutils/sidedata.py
--- a/mercurial/revlogutils/sidedata.py
+++ b/mercurial/revlogutils/sidedata.py
@@ -48,6 +48,12 @@
 SD_TEST6 = 6
 SD_TEST7 = 7
 
+# key to store copies related information
+SD_P1COPIES = 8
+SD_P2COPIES = 9
+SD_FILESADDED = 10
+SD_FILESREMOVED = 11
+
 # internal format constant
 SIDEDATA_HEADER = struct.Struct('>H')
 SIDEDATA_ENTRY = struct.Struct('>HL20s')
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -759,10 +759,13 @@
 else: # explicitly mark repo as using revlogv0
 options['revlogv0'] = True
 
-writecopiesto = ui.config('experimental', 'copies.write-to')
-copiesextramode = ('changeset-only', 'compatibility')
-if (writecopiesto in copiesextramode):
-options['copies-storage'] = 'extra'
+if COPIESSDC_REQUIREMENT in requirements:
+options['copies-storage'] = 'changeset-sidedata'
+else:
+writecopiesto = ui.config('experimental', 'copies.write-to')
+copiesextramode = ('changeset-only', 'compatibility')
+if (writecopiesto in copiesextramode):
+options['copies-storage'] = 'extra'
 
 return options
 
@@ -1093,6 +1096,10 @@
 
 self._extrafilterid = repoview.extrafilter(ui)
 
+self.filecopiesmode = None
+if COPIESSDC_REQUIREMENT in self.requirements:
+self.filecopiesmode = 'changeset-sidedata'
+
 def _getvfsward(self, origfunc):
 """build a ward for self.vfs"""
 rref = weakref.ref(self)
@@ -2686,10 +2693,15 @@
 p1, p2 = 

D6952: sidedatacopies: preindent some copies related code

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This make the next changeset clearer.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -455,55 +455,58 @@
 return sorted(modified)
 
 def filesadded(self):
-source = self._repo.ui.config('experimental', 'copies.read-from')
 filesadded = self._changeset.filesadded
-if source == 'changeset-only':
-if filesadded is None:
-filesadded = []
-elif source == 'compatibility':
-if filesadded is None:
+if True:
+source = self._repo.ui.config('experimental', 'copies.read-from')
+if source == 'changeset-only':
+if filesadded is None:
+filesadded = []
+elif source == 'compatibility':
+if filesadded is None:
+filesadded = scmutil.computechangesetfilesadded(self)
+else:
 filesadded = scmutil.computechangesetfilesadded(self)
-else:
-filesadded = scmutil.computechangesetfilesadded(self)
 return filesadded
 
 def filesremoved(self):
-source = self._repo.ui.config('experimental', 'copies.read-from')
 filesremoved = self._changeset.filesremoved
-if source == 'changeset-only':
-if filesremoved is None:
-filesremoved = []
-elif source == 'compatibility':
-if filesremoved is None:
+if True:
+source = self._repo.ui.config('experimental', 'copies.read-from')
+if source == 'changeset-only':
+if filesremoved is None:
+filesremoved = []
+elif source == 'compatibility':
+if filesremoved is None:
+filesremoved = scmutil.computechangesetfilesremoved(self)
+else:
 filesremoved = scmutil.computechangesetfilesremoved(self)
-else:
-filesremoved = scmutil.computechangesetfilesremoved(self)
 return filesremoved
 
 @propertycache
 def _copies(self):
-source = self._repo.ui.config('experimental', 'copies.read-from')
 p1copies = self._changeset.p1copies
 p2copies = self._changeset.p2copies
-# If config says to get copy metadata only from changeset, then return
-# that, defaulting to {} if there was no copy metadata.
-# In compatibility mode, we return copy data from the changeset if
-# it was recorded there, and otherwise we fall back to getting it from
-# the filelogs (below).
-if source == 'changeset-only':
-if p1copies is None:
-p1copies = {}
-if p2copies is None:
-p2copies = {}
-elif source == 'compatibility':
-if p1copies is None:
-# we are in compatiblity mode and there is not data in the
-# changeset), we get the copy metadata from the filelogs.
+if True:
+source = self._repo.ui.config('experimental', 'copies.read-from')
+# If config says to get copy metadata only from changeset, then
+# return that, defaulting to {} if there was no copy metadata.  In
+# compatibility mode, we return copy data from the changeset if it
+# was recorded there, and otherwise we fall back to getting it from
+# the filelogs (below).
+if source == 'changeset-only':
+if p1copies is None:
+p1copies = {}
+if p2copies is None:
+p2copies = {}
+elif source == 'compatibility':
+if p1copies is None:
+# we are in compatiblity mode and there is not data in the
+# changeset), we get the copy metadata from the filelogs.
+p1copies, p2copies = super(changectx, self)._copies
+else:
+# config said to read only from filelog, we get the copy
+# metadata from the filelogs.
 p1copies, p2copies = super(changectx, self)._copies
-else:
-# config said to read only from filelog, we get the copy metadata
-# from the filelogs.
-p1copies, p2copies = super(changectx, self)._copies
 return p1copies, p2copies
 
 def description(self):



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


D6951: sidedatacopies: get and store sidedata in the changelogrevision object

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The object provide a simple way to access changelog entry, we need it to also
  bear the sidedata value.
  
  Since the sidedata are retrieved at the same time as the revision, we can do
  that without extra cost.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -245,9 +245,10 @@
 __slots__ = (
 r'_offsets',
 r'_text',
+r'_sidedata',
 )
 
-def __new__(cls, text):
+def __new__(cls, text, sidedata):
 if not text:
 return _changelogrevision(extra=_defaultextra)
 
@@ -279,6 +280,7 @@
 
 self._offsets = (nl1, nl2, nl3, doublenl)
 self._text = text
+self._sidedata = sidedata
 
 return self
 
@@ -582,7 +584,7 @@
 ``changelogrevision`` instead, as it is faster for partial object
 access.
 """
-c = changelogrevision(self.revision(node))
+c = changelogrevision(*self._revisiondata(node))
 return (
 c.manifest,
 c.user,
@@ -594,7 +596,8 @@
 
 def changelogrevision(self, nodeorrev):
 """Obtain a ``changelogrevision`` for a node or revision."""
-return changelogrevision(self.revision(nodeorrev))
+text, sidedata = self._revisiondata(nodeorrev)
+return changelogrevision(text, sidedata)
 
 def readfiles(self, node):
 """



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


D6949: sidedatacopies: introduce a sidedata testcase for test-copies-in-changeset.t

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For now it is equivalent to the filelog case, but introducing this early helps
  make the comings changesets clearer.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -1,4 +1,6 @@
+#testcases extra sidedata
 
+#if extra
   $ cat >> $HGRCPATH << EOF
   > [experimental]
   > copies.write-to=changeset-only
@@ -7,6 +9,18 @@
   > changesetcopies = log -r . -T 'files: {files}
   >   {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
   >   {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
+  > EOF
+#endif
+
+#if sidedata
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+#endif
+
+  $ cat >> $HGRCPATH << EOF
+  > [alias]
   > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
   > [extensions]
   > rebase =
@@ -17,6 +31,31 @@
 
   $ hg init repo
   $ cd repo
+#if sidedata
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:  yesyes  no
+  copies-sdc:yesyes  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+#else
+  $ hg debugformat -v
+  format-variantrepo config default
+  fncache:   yesyes yes
+  dotencode: yesyes yes
+  generaldelta:  yesyes yes
+  sparserevlog:  yesyes yes
+  sidedata:   no no  no
+  copies-sdc: no no  no
+  plain-cl-delta:yesyes yes
+  compression:   zlib   zlibzlib
+  compression-level: default default default
+#endif
   $ echo a > a
   $ hg add a
   $ hg ci -m initial
@@ -24,6 +63,9 @@
   $ hg cp a c
   $ hg cp a d
   $ hg ci -m 'copy a to b, c, and d'
+
+#if extra
+
   $ hg changesetcopies
   files: b c d
   filesadded: 0
@@ -33,29 +75,44 @@
   p1copies: 0\x00a (esc)
   1\x00a (esc)
   2\x00a (esc)
+
+#endif
+
   $ hg showcopies
   a -> b
   a -> c
   a -> d
+
+#if extra
+
   $ hg showcopies --config experimental.copies.read-from=compatibility
   a -> b
   a -> c
   a -> d
   $ hg showcopies --config experimental.copies.read-from=filelog-only
 
+#endif
+
 Check that renames are recorded correctly
 
   $ hg mv b b2
   $ hg ci -m 'rename b to b2'
+
+#if extra
+
   $ hg changesetcopies
   files: b b2
   filesadded: 1
   filesremoved: 0
   
   p1copies: 1\x00b (esc)
+
+#endif
+
   $ hg showcopies
   b -> b2
 
+
 Rename onto existing file. This should get recorded in the changeset files 
list and in the extras,
 even though there is no filelog entry.
 
@@ -63,20 +120,51 @@
   $ hg st --copies
   M c
 b2
+
+#if extra
+
   $ hg debugindex c
  rev linkrev nodeid   p1   p2
0   1 b789fdd96dc2  
+
+#else
+
+  $ hg debugindex c
+ rev linkrev nodeid   p1   p2
+   0   1 37d9b5d994ea  
+
+#endif
+
+
   $ hg ci -m 'move b onto d'
+
+#if extra
+
   $ hg changesetcopies
   files: c
   
   p1copies: 0\x00b2 (esc)
+
+#endif
+
   $ hg showcopies
   b2 -> c
+
+#if extra
+
   $ hg debugindex c
  rev linkrev nodeid   p1   p2
0   1 b789fdd96dc2  
 
+#else
+
+  $ hg debugindex c
+ rev linkrev nodeid   p1   p2
+   0   1 37d9b5d994ea  
+   1   3 029625640347  
+
+#endif
+
 Create a merge commit with copying done during merge.
 
   $ hg co 0
@@ -96,6 +184,9 @@
 File 'f' exists only in p1, so 'i' should be from p1
   $ hg cp f i
   $ hg ci -m 'merge'
+
+#if extra
+
   $ hg changesetcopies
   files: g h i
   filesadded: 0
@@ -105,6 +196,9 @@
   p1copies: 0\x00a (esc)
   2\x00f (esc)
   p2copies: 1\x00d (esc)
+
+#endif
+
   $ hg showcopies
   a -> g
   d -> h
@@ -113,6 +207,7 @@
 Test writing to both changeset and filelog
 
   $ hg cp a j
+#if extra
   $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
   $ hg changesetcopies
   files: j
@@ -121,6 +216,9 @@
   
   p1copies: 0\x00a (esc)
   p2copies: 
+#else
+  $ hg ci -m 'copy a to j'
+#endif
   $ hg debugdata j 0
   \x01 (esc)
   copy: a
@@ -135,17 +233,23 @@
   a -> j
 Existing copy information in the changeset gets removed on amend and writing
 copy information on to the filelog
+#if extra
   $ hg ci --amend -m 'copy a to j, v2' \
   > --config experimental.copies.write-to=filelog-only
-  saved backup bundle to 

D6946: sidedatacopies: teach upgrade about the new requirement

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The `debugformat` and `debugupgraderepo` command now detect the requirement.
  (upgrade to and from are not currently possible).

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-lfs-serve.t
  tests/test-sidedata.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
@@ -58,6 +58,7 @@
   generaldelta:  yes
   sparserevlog:  yes
   sidedata:   no
+  copies-sdc: no
   plain-cl-delta:yes
   compression:   zlib
   compression-level: default
@@ -68,6 +69,7 @@
   generaldelta:  yesyes yes
   sparserevlog:  yesyes yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -78,6 +80,7 @@
   generaldelta:  yesyes yes
   sparserevlog:  yesyes yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -88,6 +91,7 @@
   [formatvariant.name.uptodate|generaldelta: 
][formatvariant.repo.uptodate| yes][formatvariant.config.default|
yes][formatvariant.default| yes]
   [formatvariant.name.uptodate|sparserevlog: 
][formatvariant.repo.uptodate| yes][formatvariant.config.default|
yes][formatvariant.default| yes]
   [formatvariant.name.uptodate|sidedata: 
][formatvariant.repo.uptodate|  no][formatvariant.config.default| 
no][formatvariant.default|  no]
+  [formatvariant.name.uptodate|copies-sdc:   
][formatvariant.repo.uptodate|  no][formatvariant.config.default| 
no][formatvariant.default|  no]
   [formatvariant.name.uptodate|plain-cl-delta:   
][formatvariant.repo.uptodate| yes][formatvariant.config.default|
yes][formatvariant.default| yes]
   [formatvariant.name.uptodate|compression:  
][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   
zlib][formatvariant.default|zlib]
   
[formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| 
default][formatvariant.config.default| default][formatvariant.default| default]
@@ -124,6 +128,12 @@
 "repo": false
},
{
+"config": false,
+"default": false,
+"name": "copies-sdc",
+"repo": false
+   },
+   {
 "config": true,
 "default": true,
 "name": "plain-cl-delta",
@@ -152,6 +162,9 @@
   sidedata
  Allows storage of extra data alongside a revision.
   
+  copies-sdc
+ Allows to use more efficient algorithm to deal with copy tracing.
+  
   additional optimizations are available by specifying "--optimize ":
   
   re-delta-parent
@@ -179,6 +192,9 @@
   sidedata
  Allows storage of extra data alongside a revision.
   
+  copies-sdc
+ Allows to use more efficient algorithm to deal with copy tracing.
+  
   re-delta-parent
  deltas within internal storage will choose a new base revision if needed
   
@@ -206,6 +222,9 @@
   sidedata
  Allows storage of extra data alongside a revision.
   
+  copies-sdc
+ Allows to use more efficient algorithm to deal with copy tracing.
+  
   re-delta-parent
  deltas within internal storage will choose a new base revision if needed
   
@@ -242,6 +261,7 @@
   generaldelta:   no
   sparserevlog:   no
   sidedata:   no
+  copies-sdc: no
   plain-cl-delta:yes
   compression:   zlib
   compression-level: default
@@ -252,6 +272,7 @@
   generaldelta:   noyes yes
   sparserevlog:   noyes yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -262,6 +283,7 @@
   generaldelta:   no no yes
   sparserevlog:   no no yes
   sidedata:   no no  no
+  copies-sdc: no no  no
   plain-cl-delta:yesyes yes
   compression:   zlib   zlibzlib
   compression-level: default default default
@@ -272,6 +294,7 @@
   [formatvariant.name.mismatchdefault|generaldelta: 
][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special| 
no][formatvariant.default| yes]
   [formatvariant.name.mismatchdefault|sparserevlog: 
][formatvariant.repo.mismatchdefault|  no][formatvariant.config.special| 
no][formatvariant.default| yes]
   [formatvariant.name.uptodate|sidedata: 
][formatvariant.repo.uptodate|  no][formatvariant.config.default| 
no][formatvariant.default|  

D6945: sidedatacopies: add a new requirement for storing copies into sidedata

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The end goal is to have changesets centric sidedata information stored into
  changelog sidedata. This make it possible to use the changeset based copy
  tracing algorithm on any repository without affecting hashes.
  
  The actual implementation is coming. The feature is marked as experimental
  (do not use in production) until we stabilise details about the format.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -398,6 +398,10 @@
 # information for revision without altering their original hashes.
 SIDEDATA_REQUIREMENT = 'exp-sidedata-flag'
 
+# A repository with the the copies-sidedata-changeset requirement will store
+# copies related information in changeset's sidedata.
+COPIESSDC_REQUIREMENT = 'exp-copies-sidedata-changeset'
+
 # Functions receiving (ui, features) that extensions can register to impact
 # the ability to load repositories with custom requirements. Only
 # functions defined in loaded extensions are called.
@@ -923,6 +927,7 @@
 'revlogv1',
 'generaldelta',
 'treemanifest',
+COPIESSDC_REQUIREMENT,
 REVLOGV2_REQUIREMENT,
 SIDEDATA_REQUIREMENT,
 SPARSEREVLOG_REQUIREMENT,
@@ -3165,6 +3170,10 @@
 # experimental config: format.use-side-data
 if ui.configbool('format', 'use-side-data'):
 requirements.add(SIDEDATA_REQUIREMENT)
+# experimental config: format.exp-use-copies-side-data-changeset
+if ui.configbool('format', 'exp-use-copies-side-data-changeset'):
+requirements.add(SIDEDATA_REQUIREMENT)
+requirements.add(COPIESSDC_REQUIREMENT)
 if ui.configbool('experimental', 'treemanifest'):
 requirements.add('treemanifest')
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -733,6 +733,10 @@
 coreconfigitem('format', 'usestore',
 default=True,
 )
+coreconfigitem('format', 'exp-use-copies-side-data-changeset',
+default=False,
+experimental=True,
+)
 coreconfigitem('format', 'use-side-data',
 default=False,
 experimental=True,



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


D6948: sidedatacopies: introduce a sidedata testcase for test-copies-unrelated.t

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For now it is equivalent to the filelog case, but introducing this early helps
  make the comings changesets clearer.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-copies-unrelated.t

CHANGE DETAILS

diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t
--- a/tests/test-copies-unrelated.t
+++ b/tests/test-copies-unrelated.t
@@ -1,4 +1,4 @@
-#testcases filelog compatibility changeset
+#testcases filelog compatibility changeset sidedata
 
   $ cat >> $HGRCPATH << EOF
   > [extensions]
@@ -22,6 +22,13 @@
   > EOF
 #endif
 
+#if sidedata
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-copies-side-data-changeset = yes
+  > EOF
+#endif
+
   $ REPONUM=0
   $ newrepo() {
   > cd $TESTTMP
@@ -172,8 +179,8 @@
   o  0 add x
  x
   $ hg debugpathcopies 0 5
-  x -> y (no-filelog !)
-#if no-filelog
+  x -> y (no-filelog no-sidedata !)
+#if no-filelog no-sidedata
   $ hg graft -r 2
   grafting 2:* "modify x again" (glob)
   merging y and x to y
@@ -340,8 +347,12 @@
   o  0 base
  a
   $ hg debugpathcopies 1 5
-  x -> y (no-filelog !)
-#if filelog
+  x -> y (no-filelog no-sidedata !)
+#if no-filelog no-sidedata
+  $ hg graft -r 2
+  grafting 2:* "modify x" (glob)
+  merging y and x to y
+#else
 BROKEN: This should succeed and merge the changes from x into y
   $ hg graft -r 2
   grafting 2:* "modify x" (glob)
@@ -351,10 +362,6 @@
   abort: unresolved conflicts, can't continue
   (use 'hg resolve' and 'hg graft --continue')
   [255]
-#else
-  $ hg graft -r 2
-  grafting 2:* "modify x" (glob)
-  merging y and x to y
 #endif
   $ hg co -qC 2
 BROKEN: This should succeed and merge the changes from x into y



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


D6944: debugsidedata: small doc improvement

2019-10-03 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The command has a mode to actually show the sidedata, but it wasn't 
documented.

REPOSITORY
  rHG Mercurial

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

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
@@ -2642,7 +2642,9 @@
 
 @command('debugsidedata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
 def debugsidedata(ui, repo, file_, rev=None, **opts):
-"""dump the side data for a cl/manifest/file revision"""
+"""dump the side data for a cl/manifest/file revision
+
+Use --verbose to dump the sidedata content."""
 opts = pycompat.byteskwargs(opts)
 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
 if rev is not None:



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