Commits

Pierre-Yves David committed 0eceb5a

obsolete: fix changelog reload

This changelog was not properly reloaded. This leaded to bug with rollback and
strip.

Comments (0)

Files changed (2)

 
         @storecache('00changelog.i')
         def changelog(self):
-            changelog = getattr(super(obsoletingrepo, self), 'changelog')
-            old = changelog.__dict__.pop('hiddenrevs', ())
+            # << copy pasted from mercurila source
+            c = changelog.changelog(self.sopener)
+            if 'HG_PENDING' in os.environ:
+                p = os.environ['HG_PENDING']
+                if p.startswith(self.root):
+                    c.readpending('00changelog.i.a')
+            # >> end of the copy paste
+            old = c.__dict__.pop('hiddenrevs', ())
             if old:
                 ui.warn("old wasn't empty ? %r" % old)
-            def _sethidden(changelog, value):
+            def _sethidden(c, value):
                 assert not value
 
 
-            class hchangelog(changelog.__class__):
+            class hchangelog(c.__class__):
                 @util.propertycache
-                def hiddenrevs(changelog):
+                def hiddenrevs(c):
                     shown = ['not obsolete()', '.', 'bookmark()', 'tagged()',
                              'public()']
                     basicquery = 'obsolete() - (::(%s))' % (' or '.join(shown))
                     # !!! self is repo not changelog
                     result = set(scmutil.revrange(self, [basicquery]))
                     return result
-            changelog.__class__ = hchangelog
-            return changelog
+            c.__class__ = hchangelog
+            return c
 
 
 

tests/test-obsolete.t

   adding manifests
   adding file changes
   added 5 changesets with 5 changes to 5 files (+1 heads)
-  $ qlog -R ../other-new verify
+  $ hg -R ../other-new verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  5 files, 5 changesets, 5 total revisions
   $ qlog -R ../other-new -r 'obsolete()'
   2
   - 0d3f46688ccc
   $ hg push ../other-new
   pushing to ../other-new
   searching for changes
-  no changes found
+  no changes found (ignored 0 secret changesets)
   [1]
 
   $ hg up -q .^ # 3
   $ mkcommit "obsol_d''"
   created new head
   $ hg debugobsolete 8 7
-  $ hg -R ../other-new pull .
-  pulling from .
+  $ cd ../other-new
+  $ hg up -q 3
+  $ hg pull ../local/
+  pulling from ../local/
   searching for changes
   adding changesets
   adding manifests
   added 1 changesets with 1 changes to 1 files (+1 heads)
   (run 'hg heads .' to see heads, 'hg merge' to merge)
 
-  $ qlog -R ../other-new
+  $ hg up -q 7 # to check rollback update behavior
+  $ qlog
   7
   - 159dfc9fa5d3
   3
   - 7c3bad9141dc
   0
   - 1f0dee641bb7
-  $ hg -R ../other-new rollback
+  $ hg rollback
   repository tip rolled back to revision 6 (undo pull)
-  $ qlog -R ../other-new
+  working directory now based on revision 3
+  $ hg summary
+  parent: 3:725c380fe99b 
+   add obsol_c'
+  branch: default
+  commit: 1 deleted, 2 unknown (clean)
+  update: 4 new changesets, 4 branch heads (merge)
+  $ qlog
   6
   - 909a0fb57e5d
   3
   - 7c3bad9141dc
   0
   - 1f0dee641bb7
+  $ cd ../local
 
 obsolete public changeset