Mercurial > hgsubversion
comparison tests/test_utility_commands.py @ 149:04800fda7af5
rebase: preserve local branch names.
Note: this commit introduces a dependency on Mercurial 1.1.1 or later.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 22 Dec 2008 21:20:10 -0600 |
parents | 9ffde8662967 |
children | 46f6b872c988 |
comparison
equal
deleted
inserted
replaced
148:0c5f6420a8b5 | 149:04800fda7af5 |
---|---|
1 import os | |
1 import urllib # for url quoting | 2 import urllib # for url quoting |
2 | 3 |
3 from mercurial import ui | 4 from mercurial import ui |
4 from mercurial import hg | 5 from mercurial import hg |
6 from mercurial import revlog | |
7 from mercurial import context | |
5 | 8 |
6 import utility_commands | 9 import utility_commands |
7 import fetch_command | 10 import fetch_command |
8 import test_util | 11 import test_util |
9 | 12 |
47 u = ui.ui() | 50 u = ui.ui() |
48 utility_commands.print_wc_url(u, self.repo, self.wc_path) | 51 utility_commands.print_wc_url(u, self.repo, self.wc_path) |
49 expected = 'file://%s\n' % urllib.quote(self.repo_path) | 52 expected = 'file://%s\n' % urllib.quote(self.repo_path) |
50 self.assertEqual(u.stream.getvalue(), expected) | 53 self.assertEqual(u.stream.getvalue(), expected) |
51 | 54 |
55 def test_rebase(self): | |
56 self._load_fixture_and_fetch('two_revs.svndump') | |
57 parents = (self.repo[0].node(), revlog.nullid, ) | |
58 def filectxfn(repo, memctx, path): | |
59 return context.memfilectx(path=path, | |
60 data='added', | |
61 islink=False, | |
62 isexec=False, | |
63 copied=False) | |
64 ctx = context.memctx(self.repo, | |
65 parents, | |
66 'automated test', | |
67 ['added_bogus_file', 'other_added_file', ], | |
68 filectxfn, | |
69 'testy', | |
70 '2008-12-21 16:32:00 -0500', | |
71 {'branch': 'localbranch', }) | |
72 self.repo.commitctx(ctx) | |
73 self.assertEqual(self.repo['tip'].branch(), 'localbranch') | |
74 beforerebasehash = self.repo['tip'].node() | |
75 hg.update(self.repo, 'tip') | |
76 utility_commands.rebase_commits(ui.ui(), self.repo, os.path.dirname(self.repo.path)) | |
77 self.assertEqual(self.repo['tip'].branch(), 'localbranch') | |
78 self.assertEqual(self.repo['tip'].parents()[0].parents()[0], self.repo[0]) | |
79 self.assertNotEqual(beforerebasehash, self.repo['tip'].node()) | |
80 | |
52 def test_url_is_normalized(self): | 81 def test_url_is_normalized(self): |
53 """Verify url gets normalized on initial clone. | 82 """Verify url gets normalized on initial clone. |
54 """ | 83 """ |
55 test_util.load_svndump_fixture(self.repo_path, 'two_revs.svndump') | 84 test_util.load_svndump_fixture(self.repo_path, 'two_revs.svndump') |
56 fetch_command.fetch_revisions(ui.ui(), | 85 fetch_command.fetch_revisions(ui.ui(), |