Mercurial > hgsubversion
comparison util.py @ 140:9ffde8662967
util: Add a command to normalize svn urls and use it in a couple of places. Test that it works and prevents failed assertions.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Thu, 11 Dec 2008 20:41:57 -0600 |
| parents | 291925677a9f |
| children | 1fde85a10f9e |
comparison
equal
deleted
inserted
replaced
| 139:89a737852d33 | 140:9ffde8662967 |
|---|---|
| 19 for name, func in sorted(svn_subcommands.items()): | 19 for name, func in sorted(svn_subcommands.items()): |
| 20 short_description = (func.__doc__ or '').split('\n')[0] | 20 short_description = (func.__doc__ or '').split('\n')[0] |
| 21 ret.append(" %-10s %s" % (name, short_description)) | 21 ret.append(" %-10s %s" % (name, short_description)) |
| 22 | 22 |
| 23 return "\n".join(ret) + '\n' | 23 return "\n".join(ret) + '\n' |
| 24 | |
| 25 | |
| 26 def normalize_url(svn_url): | |
| 27 while svn_url[-1] == '/': | |
| 28 svn_url = svn_url[:-1] | |
| 29 return svn_url | |
| 24 | 30 |
| 25 | 31 |
| 26 def wipe_all_files(hg_wc_path): | 32 def wipe_all_files(hg_wc_path): |
| 27 files = [f for f in os.listdir(hg_wc_path) if f != '.hg'] | 33 files = [f for f in os.listdir(hg_wc_path) if f != '.hg'] |
| 28 for f in files: | 34 for f in files: |
| 67 | 73 |
| 68 | 74 |
| 69 class PrefixMatch(object): | 75 class PrefixMatch(object): |
| 70 def __init__(self, prefix): | 76 def __init__(self, prefix): |
| 71 self.p = prefix | 77 self.p = prefix |
| 72 | 78 |
| 73 def files(self): | 79 def files(self): |
| 74 return [] | 80 return [] |
| 75 | 81 |
| 76 def __call__(self, fn): | 82 def __call__(self, fn): |
| 77 return fn.startswith(self.p) | 83 return fn.startswith(self.p) |
| 78 | 84 |
| 79 def outgoing_revisions(ui, repo, hg_editor, reverse_map): | 85 def outgoing_revisions(ui, repo, hg_editor, reverse_map): |
| 80 """Given a repo and an hg_editor, determines outgoing revisions for the | 86 """Given a repo and an hg_editor, determines outgoing revisions for the |
