annotate push_cmd.py @ 58:a8b9c7e7c2ac

Fix a bug in real replay where dirs copied from outside the directory tree weren't removing the prefix within the repo.
author Augie Fackler <durin42@gmail.com>
date Tue, 04 Nov 2008 09:40:58 -0600
parents c3c5546eefb1
children 41dc00c7aef1
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 file_data = {}
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
76 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
77 parent = rev_ctx.parents()[0]
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
78 parent_branch = rev_ctx.parents()[0].branch()
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
79 branch_path = 'trunk'
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
80
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
81 if parent_branch and parent_branch != 'default':
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
82 branch_path = 'branches/%s' % parent_branch
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
83
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
84 added_dirs = []
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
85 props = {}
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
86 for file in rev_ctx.files():
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
87 new_data = base_data = ''
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88 action = ''
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89 if file in rev_ctx:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 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
91
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
92 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
93 props.setdefault(file, {})['svn:executable'] = '*'
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
94 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
95 props.setdefault(file, {})['svn:special'] = '*'
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
96
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
97 if file not in parent:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
98 action = 'add'
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
99 dirname = '/'.join(file.split('/')[:-1] + [''])
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
100 # 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
101 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
102 # 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
103 try:
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
104 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
105 except core.SubversionException, e:
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
106 # dir must not exist
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
107 added_dirs.append(dirname[:-1])
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
108 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
109 base_data = parent.filectx(file).data()
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
110 if 'x' in parent.filectx(file).flags():
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
111 if 'svn:executable' in props.setdefault(file, {}):
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
112 del props[file]['svn:executable']
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
113 else:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
114 props.setdefault(file, {})['svn:executable'] = None
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
115 if 'l' in parent.filectx(file).flags():
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
116 if props.setdefault(file, {})['svn:special']:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
117 del props[file]['svn:special']
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
118 else:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
119 props.setdefault(file, {})['svn:special'] = None
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
120 action = 'modify'
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
121 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
122 base_data = parent.filectx(file).data()
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
123 action = 'delete'
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
124 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
125
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
126 # TODO check for directory deletes here
56
0be16f306a42 push_cmd: remove redundant variable in commit_from_rev()
Patrick Mezard <pmezard@gmail.com>
parents: 44
diff changeset
127 new_target_files = ['%s/%s' % (branch_path, f) for f in rev_ctx.files()]
0be16f306a42 push_cmd: remove redundant variable in commit_from_rev()
Patrick Mezard <pmezard@gmail.com>
parents: 44
diff changeset
128 for tf, ntf in zip(rev_ctx.files(), new_target_files):
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
129 if tf in file_data:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
130 file_data[ntf] = file_data[tf]
10
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
131 if tf in props:
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
132 props[ntf] = props[tf]
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
133 del props[tf]
dfdc078661db Auto-set executable, symlink, and auto-props.
Augie Fackler <durin42@gmail.com>
parents: 9
diff changeset
134 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
135 props.setdefault(ntf, {}).update(props.get(ntf, {}))
12
c5039390332f Fix partial implementation.
Augie Fackler <durin42@gmail.com>
parents: 10
diff changeset
136 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
137 del file_data[tf]
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
138 added_dirs = ['%s/%s' % (branch_path, f) for f in added_dirs]
57
c3c5546eefb1 Don't try and add a directory more than once.
Augie Fackler <durin42@gmail.com>
parents: 56
diff changeset
139 added_dirs = set(added_dirs)
9
9eb6bf2be1e7 Fix adding files that require new directories.
Augie Fackler <durin42@gmail.com>
parents: 6
diff changeset
140 new_target_files += added_dirs
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
141 try:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
142 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
143 base_revision, set(added_dirs), props)
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
144 except core.SubversionException, e:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
145 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
146 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
147 else:
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
148 raise