annotate tests/test_fetch_truncated.py @ 131:4d42dbbb5127

hg_delta_editor: fix parent revision detection on branch copy Project items copyfrom revisions are irrelevant to parent revision detection, only the project one or those of its ancestors matter. Items copyfrom is useful when retrieving items content. Former code resulted in incorrect converted graph for pyglet repository, especially on the following revision: ------------------------------------------------------------------------ r274 | r1chardj0n3s | 2006-12-21 02:02:14 +0100 (Jeu, 21 Dec 2006) | 2 lines Changed paths: A /branches/richard-glx-version (from /trunk:269) M /branches/richard-glx-version/pyglet/window/xlib/__init__.py R /branches/richard-glx-version/tests/test.py (from /trunk/tests/test.py:270) R /branches/richard-glx-version/tools/info.py (from /trunk/tools/info.py:272) R /branches/richard-glx-version/website/get_involved.php (from /trunk/website/get_involved.php:273) Branching to horribly mangle GLX
author Patrick Mezard <pmezard@gmail.com>
date Wed, 10 Dec 2008 11:03:22 -0600
parents 3b60f223893a
children 4950b18cf949
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 import unittest
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3 from mercurial import hg
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
4 from mercurial import ui
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
6 import fetch_command
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
7 import test_util
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
8
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
9 class TestFetchTruncatedHistory(test_util.TestBase):
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
10 def test_truncated_history(self, stupid=False):
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11 # Test repository does not follow the usual layout
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12 test_util.load_svndump_fixture(self.repo_path, 'truncatedhistory.svndump')
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 svn_url = test_util.fileurl(self.repo_path + '/project2')
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 fetch_command.fetch_revisions(ui.ui(),
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 svn_url=svn_url,
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16 hg_repo_path=self.wc_path,
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 stupid=stupid)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
18 repo = hg.repository(ui.ui(), self.wc_path)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
19
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 # We are converting /project2/trunk coming from:
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 #
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 # Changed paths:
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23 # D /project1
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 # A /project2/trunk (from /project1:2)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25 #
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
26 # Here a full fetch should be performed since we are starting
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
27 # the conversion on an already filled branch.
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
28 tip = repo['tip']
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
29 files = tip.manifest().keys()
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
30 files.sort()
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
31 self.assertEqual(files, ['a', 'b'])
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32 self.assertEqual(repo['tip']['a'].data(), 'a\n')
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
34 def test_truncated_history_stupid(self):
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35 self.test_truncated_history(True)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37 def suite():
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchTruncatedHistory),
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 ]
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40 return unittest.TestSuite(all)