Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.

Fixed a bunch of tests as a result. This likely will make new conversions of some repos have new revisions in them.
This commit is contained in:
Augie Fackler 2009-03-27 16:56:07 -05:00
parent fb3ecc8ed3
commit 9bb1cfc43f
4 changed files with 36 additions and 57 deletions

View File

@ -85,6 +85,8 @@ def rebuildmeta(ui, repo, hg_repo_path, args, **opts):
branchinfofile = open(os.path.join(svnmetadir, 'branch_info'), 'w')
pickle.dump(branchinfo, branchinfofile)
branchinfofile.close()
# now handle tags
tagsinfo = {}
realtags = svn.tags
tagsleft = realtags.items()
@ -103,10 +105,11 @@ def rebuildmeta(ui, repo, hg_repo_path, args, **opts):
older_tags = svn.tags_at_rev(rev)
newsrc, newrev = older_tags[src]
tagsleft.append((tag, (newsrc, newrev)))
if source.startswith('branches/') or source == 'trunk':
continue
else:
source = determinebranch(source)
if rev <= last_rev:
tagsinfo[tag] = source, rev
if rev <= last_rev:
tagsinfo[tag] = source, rev
tagsinfofile = open(os.path.join(svnmetadir, 'tag_info'), 'w')
pickle.dump(tagsinfo, tagsinfofile)
tagsinfofile.close()
@ -114,10 +117,11 @@ rebuildmeta = util.register_subcommand('rebuildmeta')(rebuildmeta)
rebuildmeta = util.command_needs_no_url(rebuildmeta)
def determinebranch(branch):
if branch.startswith('branches'):
assert not branch.startswith('tags/'), "Tags can't be tags of other tags."
if branch.startswith('branches/'):
branch = branch[len('branches/'):]
elif branch == 'trunk':
branch = None
else:
assert False, 'Unhandled case while regenerating metadata.'
branch = '../' + branch
return branch

View File

@ -211,6 +211,8 @@ class SubversionRepo(object):
source = hist.paths[path].copyfrom_path
source_rev = 0
for p in hist.paths:
if not p.startswith(path):
continue
if hist.paths[p].copyfrom_rev:
# We assume that the revision of the source tree as it was
# copied was actually the revision of the highest revision
@ -247,26 +249,8 @@ class SubversionRepo(object):
The reason this is lazy is so that you can use the same repo object
to perform RA calls to get deltas.
"""
# NB: you'd think this would work, but you'd be wrong. I'm pretty
# convinced there must be some kind of svn bug here.
#return self.fetch_history_at_paths(['tags', 'trunk', 'branches'],
# start=start)
# this does the same thing, but at the repo root + filtering. It's
# kind of tough cookies, sadly.
for r in self.fetch_history_at_paths([''], start=start,
chunk_size=chunk_size):
should_yield = False
i = 0
paths = list(r.paths.keys())
while i < len(paths) and not should_yield:
p = paths[i]
if (p.startswith('trunk') or p.startswith('tags')
or p.startswith('branches')):
should_yield = True
i += 1
if should_yield:
yield r
return self.fetch_history_at_paths([''], start=start,
chunk_size=chunk_size)
def fetch_history_at_paths(self, paths, start=None, stop=None,
chunk_size=1000):

View File

@ -11,8 +11,7 @@ class TestFetchExternals(test_util.TestBase):
f['t 2'] = 'dir2 -r10 svn://foobar'
f['t3'] = ['dir31 -r10 svn://foobar', 'dir32 -r10 svn://foobar']
refext = """\
[t 2]
refext = """[t 2]
dir2 -r10 svn://foobar
[t1]
dir1 -r10 svn://foobar
@ -32,55 +31,49 @@ class TestFetchExternals(test_util.TestBase):
def test_externals(self, stupid=False):
repo = self._load_fixture_and_fetch('externals.svndump', stupid=stupid)
ref0 = """\
[.]
ref0 = """[.]
^/externals/project1 deps/project1
"""
self.assertEqual(ref0, repo[0]['.hgsvnexternals'].data())
ref1 = """\
[.]
self.assertEqual(ref0, repo[0+2]['.hgsvnexternals'].data())
ref1 = """[.]
^/externals/project1 deps/project1
^/externals/project2 deps/project2
"""
self.assertEqual(ref1, repo[1]['.hgsvnexternals'].data())
self.assertEqual(ref1, repo[1+2]['.hgsvnexternals'].data())
ref2 = """\
[.]
ref2 = """[.]
^/externals/project2 deps/project2
[subdir]
^/externals/project1 deps/project1
[subdir2]
^/externals/project1 deps/project1
"""
self.assertEqual(ref2, repo[2]['.hgsvnexternals'].data())
actual = repo[2+2]['.hgsvnexternals'].data()
self.assertEqual(ref2, actual)
ref3 = """\
[.]
ref3 = """[.]
^/externals/project2 deps/project2
[subdir]
^/externals/project1 deps/project1
"""
self.assertEqual(ref3, repo[3]['.hgsvnexternals'].data())
self.assertEqual(ref3, repo[3+2]['.hgsvnexternals'].data())
ref4 = """\
[subdir]
ref4 = """[subdir]
^/externals/project1 deps/project1
"""
self.assertEqual(ref4, repo[4]['.hgsvnexternals'].data())
self.assertEqual(ref4, repo[4+2]['.hgsvnexternals'].data())
ref5 = """\
[.]
ref5 = """[.]
^/externals/project2 deps/project2
[subdir2]
^/externals/project1 deps/project1
"""
self.assertEqual(ref5, repo[5]['.hgsvnexternals'].data())
self.assertEqual(ref5, repo[5+2]['.hgsvnexternals'].data())
ref6 = """\
[.]
ref6 = """[.]
^/externals/project2 deps/project2
"""
self.assertEqual(ref6, repo[6]['.hgsvnexternals'].data())
self.assertEqual(ref6, repo[6+2]['.hgsvnexternals'].data())
def test_externals_stupid(self):
self.test_externals(True)
@ -97,8 +90,7 @@ class TestPushExternals(test_util.TestBase):
# Add a new reference on an existing and non-existing directory
changes = [
('.hgsvnexternals', '.hgsvnexternals',
"""\
[dir]
"""[dir]
../externals/project2 deps/project2
[subdir1]
../externals/project1 deps/project1
@ -116,8 +108,7 @@ class TestPushExternals(test_util.TestBase):
# to the other (test multiline entries)
changes = [
('.hgsvnexternals', '.hgsvnexternals',
"""\
[subdir1]
"""[subdir1]
../externals/project1 deps/project1
../externals/project2 deps/project2
"""),

View File

@ -94,12 +94,12 @@ class TestBasicRepoLayout(test_util.TestBase):
'test_files_copied_from_outside_btt.svndump')
self.assertEqual(node.hex(repo['tip'].node()),
'3c78170e30ddd35f2c32faa0d8646ab75bba4f73')
self.assertEqual(len(repo.changelog), 2)
self.assertEqual(len(repo.changelog), 3)
def test_file_renamed_in_from_outside_btt(self):
repo = self._load_fixture_and_fetch(
'file_renamed_in_from_outside_btt.svndump')
self.assert_('LICENSE.file' in repo['tip'])
self.assert_('LICENSE.file' in repo['default'])
def test_renamed_dir_in_from_outside_btt_not_repo_root(self):
repo = self._load_fixture_and_fetch(