annotate tests/test_fetch_truncated.py @ 326:33736e2e25f0

alternate approach for supporting svn schemes for repository paths We now intercept the operations in the local repo class, and handle the relevant operation ourselves. This frees us from wrapping all relevant commands and replicating their functionality. The implementation is incomplete; only one test has been modified to use the standard Mercurial API with the changed URLs. Once changed, those tests will likely reveal bugs or missing features in the new wrappers. Also, new wrappers will be needed for handling conversion flags such as -A/--authormap.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Thu, 07 May 2009 20:50:53 +0200
parents ffccf0080e54
children 75f082b5897e
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
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
6 import wrappers
88
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')
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
14 wrappers.clone(None, ui.ui(), source=svn_url,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
15 dest=self.wc_path, stupid=stupid,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
16 noupdate=True)
88
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 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
18
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
19 # 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
20 #
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 # Changed paths:
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 # D /project1
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23 # 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
24 #
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25 # 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
26 # 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
27 tip = repo['tip']
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
28 files = tip.manifest().keys()
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
29 files.sort()
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
30 self.assertEqual(files, ['a', 'b'])
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
31 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
32
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33 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
34 self.test_truncated_history(True)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36 def suite():
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchTruncatedHistory),
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 ]
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 return unittest.TestSuite(all)