Mercurial > hgsubversion
comparison push_cmd.py @ 39:b3c7b844b782
Some more fixes of cases discovered in the melange repo. If anyone knows how I can reproduce a "replaced" state in Subversion, I'd love to be able to make a real test case for this code.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sun, 26 Oct 2008 22:06:13 -0500 |
parents | c5039390332f |
children | 85fcac4e2291 |
comparison
equal
deleted
inserted
replaced
38:9ee7ce0505eb | 39:b3c7b844b782 |
---|---|
63 hge.revmap.iterkeys())) | 63 hge.revmap.iterkeys())) |
64 outgoing = utility_commands.outgoing_revisions(ui, repo, hge, | 64 outgoing = utility_commands.outgoing_revisions(ui, repo, hge, |
65 svn_commit_hashes) | 65 svn_commit_hashes) |
66 return 0 | 66 return 0 |
67 | 67 |
68 class PrefixMatch(object): | |
69 def __init__(self, prefix): | |
70 self.p = prefix | |
71 | |
72 def files(self): | |
73 return [] | |
74 | |
75 def __call__(self, fn): | |
76 return fn.startswith(self.p) | |
77 | 68 |
78 def commit_from_rev(ui, repo, rev_ctx, hg_editor, svn_url, base_revision): | 69 def commit_from_rev(ui, repo, rev_ctx, hg_editor, svn_url, base_revision): |
79 """Build and send a commit from Mercurial to Subversion. | 70 """Build and send a commit from Mercurial to Subversion. |
80 """ | 71 """ |
81 target_files = [] | 72 target_files = [] |
104 if file not in parent: | 95 if file not in parent: |
105 target_files.append(file) | 96 target_files.append(file) |
106 action = 'add' | 97 action = 'add' |
107 dirname = '/'.join(file.split('/')[:-1] + ['']) | 98 dirname = '/'.join(file.split('/')[:-1] + ['']) |
108 # check for new directories | 99 # check for new directories |
109 if not list(parent.walk(PrefixMatch(dirname))): | 100 if not list(parent.walk(util.PrefixMatch(dirname))): |
110 # check and see if the dir exists svn-side. | 101 # check and see if the dir exists svn-side. |
111 try: | 102 try: |
112 assert svn.list_dir('%s/%s' % (branch_path, dirname)) | 103 assert svn.list_dir('%s/%s' % (branch_path, dirname)) |
113 except core.SubversionException, e: | 104 except core.SubversionException, e: |
114 # dir must not exist | 105 # dir must not exist |