comparison tests/test-obsolete.t @ 24136:46d6cdfce4bf

hgweb: use introrev() for finding parents (issue4506) The issue is titled "filtered revision 'XXX' (not in 'served' subset)" and that is the error message you sometimes get when trying to look at a file (/file or /annotate) in hgweb. For example: http://hg.intevation.org/mercurial/crew/file/90cf454edd70/mercurial/cmdutil.py This happens when a parent revision for a file is hidden, thus it is not 'served' and isn't accessible in hgweb by default. When hgweb tries to access such changeset, it produces the error and HTTP status code 404. Another detail is that the parents() function, that is used in multiple places in hgweb, sometimes returned changesets that were obsoleted by the current changeset for the file. For example, when using rebase with evolve and rebasing a divergent changeset that introduces a file on top of current branch. Or grafting a change and making the new grafted changeset obsolete the source (shown in the test case). The result is the same - the obsoleted changeset was mistakingly returned from parents(), even though it's not a parent and the only link to the new changeset is an obsoletion marker (and rebase/graft metadata? not sure it matters). The problem is fixed by using introrev() instead of linkrev() for finding parents. This prevents parents() function from returning unrelated obsolete changesets. The test case prepares a separate repo because (afaict) all other test cases never reuse file names, so there are no files that were changed in multiple changesets. So no previously available files have obsolete changesets in their history.
author Anton Shestakov <engored@ya.ru>
date Thu, 19 Feb 2015 19:32:06 +0800
parents b08af8f0ac01
children 758dd85b6ad6
comparison
equal deleted inserted replaced
24135:27b6d41aa029 24136:46d6cdfce4bf
752 0 files updated, 0 files merged, 1 files removed, 0 files unresolved 752 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
753 $ hg tags 753 $ hg tags
754 visible 0:193e9254ce7e 754 visible 0:193e9254ce7e
755 tip 0:193e9254ce7e 755 tip 0:193e9254ce7e
756 756
757 #if serve
758
759 Test issue 4506
760
761 $ cd ..
762 $ hg init repo-issue4506
763 $ cd repo-issue4506
764 $ echo "0" > foo
765 $ hg add foo
766 $ hg ci -m "content-0"
767
768 $ hg up null
769 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
770 $ echo "1" > bar
771 $ hg add bar
772 $ hg ci -m "content-1"
773 created new head
774 $ hg up 0
775 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
776 $ hg graft 1
777 grafting 1:1c9eddb02162 "content-1" (tip)
778
779 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
780
781 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
782 $ cat hg.pid >> $DAEMON_PIDS
783
784 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/1'
785 404 Not Found
786 [1]
787 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'file/tip/bar'
788 200 Script output follows
789 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'annotate/tip/bar'
790 200 Script output follows
791
792 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
793
794 #endif
795
757 $ hg init a 796 $ hg init a
758 $ cd a 797 $ cd a
759 $ touch foo 798 $ touch foo
760 $ hg add foo 799 $ hg add foo
761 $ hg ci -mfoo 800 $ hg ci -mfoo