Mercurial > hgsubversion
annotate tests/test_util.py @ 67:e319c9168910
hg_delta_editor: register svn file copies
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 05 Nov 2008 13:37:07 +0100 |
parents | 1f8854804795 |
children | 072010a271c6 |
rev | line source |
---|---|
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 import os |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 import popen2 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
4 from mercurial import ui |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
5 from mercurial import hg |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
6 |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
7 import fetch_command |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
8 |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 FIXTURES = os.path.join(os.path.abspath(os.path.dirname(__file__)), |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 'fixtures') |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 def load_svndump_fixture(path, fixture_name): |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 '''Loads an svnadmin dump into a fresh repo at path, which should not |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 already exist. |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 ''' |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 os.spawnvp(os.P_WAIT, 'svnadmin', ['svnadmin', 'create', path,]) |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 proc = popen2.Popen4(['svnadmin', 'load', path,]) |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 inp = open(os.path.join(FIXTURES, fixture_name)) |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 proc.tochild.write(inp.read()) |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 proc.tochild.close() |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 proc.wait() |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
22 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
22
diff
changeset
|
23 def load_fixture_and_fetch(fixture_name, repo_path, wc_path, stupid=False): |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
24 load_svndump_fixture(repo_path, fixture_name) |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
25 fetch_command.fetch_revisions(ui.ui(), |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
26 svn_url='file://%s' % repo_path, |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
22
diff
changeset
|
27 hg_repo_path=wc_path, |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
22
diff
changeset
|
28 stupid=stupid) |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
29 repo = hg.repository(ui.ui(), wc_path) |
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
30 return repo |