Patchwork [1,of,3,STABLE] bundlerepo: properly handle hidden linkrev in filelog (issue4945)

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 23, 2016, 12:13 p.m.
Message ID <50c9e7028d6e84bd7566.1456229604@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/13308/
State Accepted
Commit 5ab6f0fde75f6c779d3b09ea809b5f286992fd5f
Delegated to: Martin von Zweigbergk
Headers show

Comments

Pierre-Yves David - Feb. 23, 2016, 12:13 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1456162540 -3600
#      Mon Feb 22 18:35:40 2016 +0100
# Branch stable
# Node ID 50c9e7028d6e84bd7566ff4db618631c7acaeacf
# Parent  1bcb4f34b9f91a2e330966182f691664fbada1bc
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 50c9e7028d6e
bundlerepo: properly handle hidden linkrev in filelog (issue4945)

The bundlerepository have to do some special magic to handle linkrev of the
bundlerepo filerev. That logic was done from a repoview and obsolescence marker
affecting bundled changeset could lead to a crash. We now ensure we operate on
unfiltered repository.
Pierre-Yves David - Feb. 23, 2016, 12:23 p.m.
On 02/23/2016 01:13 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1456162540 -3600
> #      Mon Feb 22 18:35:40 2016 +0100
> # Branch stable
> # Node ID 50c9e7028d6e84bd7566ff4db618631c7acaeacf
> # Parent  1bcb4f34b9f91a2e330966182f691664fbada1bc
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> #              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 50c9e7028d6e
> bundlerepo: properly handle hidden linkrev in filelog (issue4945)

That one is already on clowncopter default. But I realised afterward it 
deserved to be on stable so I reincluded it with the other fixes of the 
same familly.
Sean Farley - Feb. 23, 2016, 6:53 p.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> On 02/23/2016 01:13 PM, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1456162540 -3600
>> #      Mon Feb 22 18:35:40 2016 +0100
>> # Branch stable
>> # Node ID 50c9e7028d6e84bd7566ff4db618631c7acaeacf
>> # Parent  1bcb4f34b9f91a2e330966182f691664fbada1bc
>> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
>> #              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 50c9e7028d6e
>> bundlerepo: properly handle hidden linkrev in filelog (issue4945)
>
> That one is already on clowncopter default. But I realised afterward it 
> deserved to be on stable so I reincluded it with the other fixes of the 
> same familly.

Thanks a lot for these patches!

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -360,11 +360,12 @@  class bundlerepository(localrepo.localre
                     if not c:
                         break
 
         if f in self.bundlefilespos:
             self.bundle.seek(self.bundlefilespos[f])
-            return bundlefilelog(self.svfs, f, self.bundle, self.changelog.rev)
+            linkmapper = self.unfiltered().changelog.rev
+            return bundlefilelog(self.svfs, f, self.bundle, linkmapper)
         else:
             return filelog.filelog(self.svfs, f)
 
     def close(self):
         """Close assigned bundle file immediately."""
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1002,7 +1002,76 @@  bookmarks change
   $ hg log -r 13bedc178fce
   abort: hidden revision '13bedc178fce'!
   (use --hidden to access hidden revisions)
   [255]
 
+Test ability to pull changeset with locally applying obsolescence markers
+(issue4945)
 
+  $ cd ..
+  $ hg init issue4845
+  $ cd issue4845
 
+  $ echo foo > f0
+  $ hg add f0
+  $ hg ci -m '0'
+  $ echo foo > f1
+  $ hg add f1
+  $ hg ci -m '1'
+  $ echo foo > f2
+  $ hg add f2
+  $ hg ci -m '2'
+
+  $ echo bar > f2
+  $ hg commit --amend --config experimetnal.evolution=createmarkers
+  $ hg log -G
+  @  4:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  o  0:a78f55e5508c (draft) [ ] 0
+  
+  $ hg log -G --hidden
+  @  4:b0551702f918 (draft) [tip ] 2
+  |
+  | x  3:f27abbcc1f77 (draft) [ ] temporary amend commit for e008cf283490
+  | |
+  | x  2:e008cf283490 (draft) [ ] 2
+  |/
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  o  0:a78f55e5508c (draft) [ ] 0
+  
+
+  $ hg strip -r 1 --config extensions.strip=
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg (glob)
+  $ hg log -G
+  @  0:a78f55e5508c (draft) [tip ] 0
+  
+  $ hg log -G --hidden
+  @  0:a78f55e5508c (draft) [tip ] 0
+  
+
+  $ hg pull .hg/strip-backup/*
+  pulling from .hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  (run 'hg update' to get a working copy)
+  $ hg log -G
+  o  2:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  @  0:a78f55e5508c (draft) [ ] 0
+  
+  $ hg log -G --hidden
+  o  2:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  @  0:a78f55e5508c (draft) [ ] 0
+  
+