obsolete: fix changelog reload
This changelog was not properly reloaded. This leaded to bug with rollback and
strip.
--- a/hgext/obsolete.py Wed Apr 25 18:15:56 2012 +0200
+++ b/hgext/obsolete.py Wed Apr 25 18:11:52 2012 +0200
@@ -620,25 +620,31 @@
@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
--- a/tests/test-obsolete.t Wed Apr 25 18:15:56 2012 +0200
+++ b/tests/test-obsolete.t Wed Apr 25 18:11:52 2012 +0200
@@ -124,7 +124,12 @@
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
@@ -185,7 +190,7 @@
$ 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
@@ -270,8 +275,10 @@
$ 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
@@ -279,7 +286,8 @@
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
@@ -290,9 +298,16 @@
- 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
@@ -303,6 +318,7 @@
- 7c3bad9141dc
0
- 1f0dee641bb7
+ $ cd ../local
obsolete public changeset