Mercurial > hgsubversion
comparison hgsubversion/stupid.py @ 1031:4e4c47351102
stupid: use layouts library for detecting branch mapping
| author | David Schleimer <dschleimer@fb.com> |
|---|---|
| date | Tue, 25 Jun 2013 19:22:12 -0700 |
| parents | c4b25a903ad3 |
| children | 67e11b650e94 |
comparison
equal
deleted
inserted
replaced
| 1030:6fa55b6fa3f2 | 1031:4e4c47351102 |
|---|---|
| 644 if checkpath(p, revnum) == 'f': | 644 if checkpath(p, revnum) == 'f': |
| 645 actually_files.append(p) | 645 actually_files.append(p) |
| 646 # if there's a copyfrom_path and there were files inside that copyfrom, | 646 # if there's a copyfrom_path and there were files inside that copyfrom, |
| 647 # we need to detect those branches. It's a little thorny and slow, but | 647 # we need to detect those branches. It's a little thorny and slow, but |
| 648 # seems to be the best option. | 648 # seems to be the best option. |
| 649 elif paths[p].copyfrom_path and not p.startswith('tags/'): | 649 elif paths[p].copyfrom_path and not meta.get_path_tag(p): |
| 650 paths_need_discovery.extend(['%s/%s' % (p, x[0]) | 650 paths_need_discovery.extend(['%s/%s' % (p, x[0]) |
| 651 for x in listdir(p, revnum) | 651 for x in listdir(p, revnum) |
| 652 if x[1] == 'f']) | 652 if x[1] == 'f']) |
| 653 | 653 |
| 654 if not actually_files: | 654 if not actually_files: |
| 655 continue | 655 continue |
| 656 | 656 |
| 657 filepaths = [p.split('/') for p in actually_files] | 657 for path in actually_files: |
| 658 filepaths = [(len(p), p) for p in filepaths] | 658 if meta.get_path_tag(path): |
| 659 filepaths.sort() | 659 continue |
| 660 filepaths = [p[1] for p in filepaths] | 660 fpath, branch, bpath = meta.split_branch_path(path, existing=False) |
| 661 while filepaths: | 661 if bpath is None: |
| 662 path = filepaths.pop(0) | 662 continue |
| 663 parentdir = '/'.join(path[:-1]) | 663 branches[branch] = bpath |
| 664 filepaths = [p for p in filepaths if not '/'.join(p).startswith(parentdir)] | 664 |
| 665 branchpath = meta.normalize(parentdir) | |
| 666 if branchpath.startswith('tags/'): | |
| 667 continue | |
| 668 branchname = meta.localname(branchpath) | |
| 669 if branchpath.startswith('trunk/'): | |
| 670 branches[meta.localname('trunk')] = 'trunk' | |
| 671 continue | |
| 672 if branchname and branchname.startswith('../'): | |
| 673 continue | |
| 674 branches[branchname] = branchpath | |
| 675 return branches | 665 return branches |
| 676 | 666 |
| 677 def convert_rev(ui, meta, svn, r, tbdelta, firstrun): | 667 def convert_rev(ui, meta, svn, r, tbdelta, firstrun): |
| 678 # this server fails at replay | 668 # this server fails at replay |
| 679 | 669 |
