diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -584,6 +584,11 @@ coreconfigitem( default=b'', ) coreconfigitem( + b'debug', + b'revlog.debug-delta', + default=False, +) +coreconfigitem( b'defaults', b'.*', default=None, diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1070,6 +1070,7 @@ def resolverevlogstorevfsoptions(ui, req b'storage', b'revlog.optimize-delta-parent-choice' ) options[b'deltabothparents'] = deltabothparents + options[b'debug-delta'] = ui.configbool(b'debug', b'revlog.debug-delta') issue6528 = ui.configbool(b'storage', b'revlog.issue6528.fix-incoming') options[b'issue6528.fix-incoming'] = issue6528 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -346,6 +346,7 @@ class revlog: self._chunkcachesize = 65536 self._maxchainlen = None self._deltabothparents = True + self._debug_delta = False self.index = None self._docket = None self._nodemap_docket = None @@ -423,6 +424,8 @@ class revlog: self._lazydeltabase = False if self._lazydelta: self._lazydeltabase = bool(opts.get(b'lazydeltabase', False)) + if b'debug-delta' in opts: + self._debug_delta = opts[b'debug-delta'] if b'compengine' in opts: self._compengine = opts[b'compengine'] if b'zlib.level' in opts: @@ -2426,7 +2429,12 @@ class revlog: textlen = len(rawtext) if deltacomputer is None: - deltacomputer = deltautil.deltacomputer(self) + write_debug = None + if self._debug_delta: + write_debug = transaction._report + deltacomputer = deltautil.deltacomputer( + self, write_debug=write_debug + ) revinfo = revlogutils.revisioninfo( node, @@ -2639,7 +2647,13 @@ class revlog: empty = True try: with self._writing(transaction): - deltacomputer = deltautil.deltacomputer(self) + write_debug = None + if self._debug_delta: + write_debug = transaction._report + deltacomputer = deltautil.deltacomputer( + self, + write_debug=write_debug, + ) # loop through our set of deltas for data in deltas: ( @@ -3015,7 +3029,13 @@ class revlog: sidedata_helpers, ): """perform the core duty of `revlog.clone` after parameter processing""" - deltacomputer = deltautil.deltacomputer(destrevlog) + write_debug = None + if self._debug_delta: + write_debug = tr._report + deltacomputer = deltautil.deltacomputer( + destrevlog, + write_debug=write_debug, + ) index = self.index for rev in self: entry = index[rev] diff --git a/tests/test-bundle.t b/tests/test-bundle.t --- a/tests/test-bundle.t +++ b/tests/test-bundle.t @@ -1038,3 +1038,28 @@ Test the option that create slim bundle Test the option that create and no-delta's bundle $ hg bundle -a --config devel.bundle.delta=full ./full.hg 3 changesets found + +Test the debug output when applying delta +----------------------------------------- + + $ hg init foo + $ hg -R foo unbundle ./slim.hg \ + > --config debug.revlog.debug-delta=yes \ + > --config storage.revlog.reuse-external-delta=no \ + > --config storage.revlog.reuse-external-delta-parent=no + adding changesets + DBG-DELTAS: CHANGELOG: rev=0: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=-1 p2-chain-length=-1 - duration=* (glob) + DBG-DELTAS: CHANGELOG: rev=1: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=0 p2-chain-length=-1 - duration=* (glob) + DBG-DELTAS: CHANGELOG: rev=2: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=0 p2-chain-length=-1 - duration=* (glob) + adding manifests + DBG-DELTAS: MANIFESTLOG: rev=0: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=-1 p2-chain-length=-1 - duration=* (glob) + DBG-DELTAS: MANIFESTLOG: rev=1: search-rounds=1 try-count=1 - delta-type=delta snap-depth=0 - p1-chain-length=0 p2-chain-length=-1 - duration=* (glob) + DBG-DELTAS: MANIFESTLOG: rev=2: search-rounds=1 try-count=1 - delta-type=delta snap-depth=0 - p1-chain-length=1 p2-chain-length=-1 - duration=* (glob) + adding file changes + DBG-DELTAS: FILELOG:a: rev=0: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=-1 p2-chain-length=-1 - duration=* (glob) + DBG-DELTAS: FILELOG:b: rev=0: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=-1 p2-chain-length=-1 - duration=* (glob) + DBG-DELTAS: FILELOG:c: rev=0: search-rounds=0 try-count=0 - delta-type=full snap-depth=0 - p1-chain-length=-1 p2-chain-length=-1 - duration=* (glob) + added 3 changesets with 3 changes to 3 files + new changesets 4fe08cd4693e:4652c276ac4f (3 drafts) + (run 'hg update' to get a working copy) +