annotate push_cmd.py @ 48:d87b57c719f0

Add a test that verifies push works to svn:// servers. This test will fail if you are running an svnserve on localhost, but it checks and will not touch your data in that case. Also fixed the push tests, which had been largely broken.
author Augie Fackler <durin42@gmail.com>
date Wed, 29 Oct 2008 21:15:36 -0500
parents 85fcac4e2291
children 0be16f306a42
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 from mercurial import util as merc_util
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 from mercurial import hg
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 from svn import core
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 import util
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 import hg_delta_editor
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 import svnwrap
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 import fetch_command
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 import utility_commands
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 @util.register_subcommand('push')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 @util.register_subcommand('dcommit') # for git expats
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 def push_revisions_to_subversion(ui, repo, hg_repo_path, svn_url, **opts):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 """Push revisions starting at a specified head back to Subversion.
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 """
44
85fcac4e2291 Fix an encoding bug that would occur if the local encoding was not utf-8.
Augie Fackler <durin42@gmail.com>
parents: 39
diff changeset
17 oldencoding = merc_util._encoding
85fcac4e2291 Fix an encoding bug that would occur if the local encoding was not utf-8.
Augie Fackler <durin42@gmail.com>
parents: 39
diff changeset
18 merc_util._encoding = 'UTF-8'
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path,
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 ui_=ui)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 svn_commit_hashes = dict(zip(hge.revmap.itervalues(),
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 hge.revmap.iterkeys()))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 # Strategy:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 # 1. Find all outgoing commits from this head
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 outgoing = utility_commands.outgoing_revisions(ui, repo, hge,
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 svn_commit_hashes)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 if not (outgoing and len(outgoing)):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 ui.status('No revisions to push.')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 if len(repo.parents()) != 1:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 ui.status('Cowardly refusing to push branch merge')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 return 1
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 while outgoing:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 oldest = outgoing.pop(-1)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 old_ctx = repo[oldest]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 if len(old_ctx.parents()) != 1:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 ui.status('Found a branch merge, this needs discussion and '
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 'implementation.')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 return 1
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 base_n = old_ctx.parents()[0].node()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 old_children = repo[base_n].children()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 # 2. Commit oldest revision that needs to be pushed
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 base_revision = svn_commit_hashes[old_ctx.parents()[0].node()][0]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 commit_from_rev(ui, repo, old_ctx, hge, svn_url, base_revision)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 # 3. Fetch revisions from svn
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 r = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 assert not r or r == 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48 # 4. Find the new head of the target branch
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 repo = hg.repository(ui, hge.path)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 base_c = repo[base_n]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51 replacement = [c for c in base_c.children() if c not in old_children
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52 and c.branch() == old_ctx.branch()]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 assert len(replacement) == 1
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 replacement = replacement[0]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 # 5. Rebase all children of the currently-pushing rev to the new branch
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 heads = repo.heads(old_ctx.node())
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 for needs_transplant in heads:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 hg.clean(repo, needs_transplant)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 utility_commands.rebase_commits(ui, repo, hg_repo_path, **opts)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60 repo = hg.repository(ui, hge.path)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 if needs_transplant in outgoing:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 hg.clean(repo, repo['tip'].node())
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, ui_=ui)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 svn_commit_hashes = dict(zip(hge.revmap.itervalues(),
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65 hge.revmap.iterkeys()))
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66 outgoing = utility_commands.outgoing_revisions(ui, repo, hge,
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 svn_commit_hashes)
44
85fcac4e2291 Fix an encoding bug that would occur if the local encoding was not utf-8.
Augie Fackler <durin42@gmail.com>
parents: 39
diff changeset
68 merc_util._encoding = oldencoding
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 return 0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 def commit_from_rev(ui, repo, rev_ctx, hg_editor, svn_url, base_revision):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 """Build and send a commit from Mercurial to Subversion.
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74 """
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 target_files = []
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 file_data = {}
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
77 svn = svnwrap.SubversionRepo(svn_url, username=merc_util.getuser())
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
78 parent = rev_ctx.parents()[0]
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
79 parent_branch = rev_ctx.parents()[0].branch()
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
80 branch_path = 'trunk'
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
81
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
82 if parent_branch and parent_branch != 'default':
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
83 branch_path = 'branches/%s' % parent_branch
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
84
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
85 added_dirs = []
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
86 props = {}
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
87 for file in rev_ctx.files():
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 new_data = base_data = ''
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89 action = ''
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 if file in rev_ctx:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
91 new_data = rev_ctx.filectx(file).data()
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
92
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
93 if 'x' in rev_ctx.filectx(file).flags():
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
94 props.setdefault(file, {})['svn:executable'] = '*'
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
95 if 'l' in rev_ctx.filectx(file).flags():
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
96 props.setdefault(file, {})['svn:special'] = '*'
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
97
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
98 if file not in parent:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
99 target_files.append(file)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
100 action = 'add'
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
101 dirname = '/'.join(file.split('/')[:-1] + [''])
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
102 # check for new directories
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.
Augie Fackler <durin42@gmail.com>
parents: 12
diff changeset
103 if not list(parent.walk(util.PrefixMatch(dirname))):
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
104 # check and see if the dir exists svn-side.
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
105 try:
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
106 assert svn.list_dir('%s/%s' % (branch_path, dirname))
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
107 except core.SubversionException, e:
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
108 # dir must not exist
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
109 added_dirs.append(dirname[:-1])
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
110 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
111 target_files.append(file)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
112 base_data = parent.filectx(file).data()
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
113 if 'x' in parent.filectx(file).flags():
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
114 if 'svn:executable' in props.setdefault(file, {}):
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
115 del props[file]['svn:executable']
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
116 else:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
117 props.setdefault(file, {})['svn:executable'] = None
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
118 if 'l' in parent.filectx(file).flags():
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
119 if props.setdefault(file, {})['svn:special']:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
120 del props[file]['svn:special']
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
121 else:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
122 props.setdefault(file, {})['svn:special'] = None
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
123 action = 'modify'
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
124 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
125 target_files.append(file)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
126 base_data = parent.filectx(file).data()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
127 action = 'delete'
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
128 file_data[file] = base_data, new_data, action
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
129
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
130 # TODO check for directory deletes here
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
131 new_target_files = ['%s/%s' % (branch_path, f) for f in target_files]
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
132 for tf, ntf in zip(target_files, new_target_files):
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
133 if tf in file_data:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
134 file_data[ntf] = file_data[tf]
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
135 if tf in props:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
136 props[ntf] = props[tf]
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
137 del props[tf]
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
138 if merc_util.binary(file_data[ntf][1]):
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
139 props.setdefault(ntf, {}).update(props.get(ntf, {}))
12
c5039390332f Fix partial implementation.
Augie Fackler <durin42@gmail.com>
parents: 10
diff changeset
140 props.setdefault(ntf, {})['svn:mime-type'] = 'application/octet-stream'
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
141 del file_data[tf]
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
142 added_dirs = ['%s/%s' % (branch_path, f) for f in added_dirs]
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
143 new_target_files += added_dirs
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
144 try:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
145 svn.commit(new_target_files, rev_ctx.description(), file_data,
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
146 base_revision, set(added_dirs), props)
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
147 except core.SubversionException, e:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
148 if hasattr(e, 'apr_err') and e.apr_err == 160028:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
149 raise merc_util.Abort('Base text was out of date, maybe rebase?')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
150 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
151 raise