# HG changeset patch # User Augie Fackler # Date 1223319130 18000 # Node ID dfdc078661dbdc950b87e7bd34fe6d2466d75b4f # Parent 9eb6bf2be1e74a69a4f2e1ff80f9c02451f07579 Auto-set executable, symlink, and auto-props. diff --git a/push_cmd.py b/push_cmd.py --- a/push_cmd.py +++ b/push_cmd.py @@ -89,11 +89,18 @@ def commit_from_rev(ui, repo, rev_ctx, h branch_path = 'branches/%s' % parent_branch added_dirs = [] + props = {} for file in rev_ctx.files(): new_data = base_data = '' action = '' if file in rev_ctx: new_data = rev_ctx.filectx(file).data() + + if 'x' in rev_ctx.filectx(file).flags(): + props.setdefault(file, {})['svn:executable'] = '*' + if 'l' in rev_ctx.filectx(file).flags(): + props.setdefault(file, {})['svn:special'] = '*' + if file not in parent: target_files.append(file) action = 'add' @@ -106,11 +113,19 @@ def commit_from_rev(ui, repo, rev_ctx, h except core.SubversionException, e: # dir must not exist added_dirs.append(dirname[:-1]) - # TODO check for mime-type autoprops here - # TODO check for directory adds here else: target_files.append(file) base_data = parent.filectx(file).data() + if 'x' in parent.filectx(file).flags(): + if 'svn:executable' in props.setdefault(file, {}): + del props[file]['svn:executable'] + else: + props.setdefault(file, {})['svn:executable'] = None + if 'l' in parent.filectx(file).flags(): + if props.setdefault(file, {})['svn:special']: + del props[file]['svn:special'] + else: + props.setdefault(file, {})['svn:special'] = None action = 'modify' else: target_files.append(file) @@ -123,12 +138,18 @@ def commit_from_rev(ui, repo, rev_ctx, h for tf, ntf in zip(target_files, new_target_files): if tf in file_data: file_data[ntf] = file_data[tf] + if tf in props: + props[ntf] = props[tf] + del props[tf] + if merc_util.binary(file_data[ntf][1]): + props.setdefault(ntf, {}).update(props.get(ntf, {})) + props.setdefault(ntf, {})['svn:mime-type'] del file_data[tf] added_dirs = ['%s/%s' % (branch_path, f) for f in added_dirs] new_target_files += added_dirs try: svn.commit(new_target_files, rev_ctx.description(), file_data, - base_revision, set(added_dirs)) + base_revision, set(added_dirs), props) except core.SubversionException, e: if hasattr(e, 'apr_err') and e.apr_err == 160028: raise merc_util.Abort('Base text was out of date, maybe rebase?') diff --git a/svnwrap/svn_swig_wrapper.py b/svnwrap/svn_swig_wrapper.py --- a/svnwrap/svn_swig_wrapper.py +++ b/svnwrap/svn_swig_wrapper.py @@ -241,7 +241,8 @@ class SubversionRepo(object): yield revisions[0] revisions.pop(0) - def commit(self, paths, message, file_data, base_revision, dirs): + def commit(self, paths, message, file_data, base_revision, dirs, + properties): """Commits the appropriate targets from revision in editor's store. """ self.init_ra_and_client() @@ -271,6 +272,12 @@ class SubversionRepo(object): baton = editor.delete_entry(path, base_revision, parent, pool) compute_delta = False + if path in properties: + if properties[path].get('svn:special', None): + new_text = 'link %s' % new_text + for p, v in properties[path].iteritems(): + editor.change_file_prop(baton, p, v) + if compute_delta: handler, wh_baton = editor.apply_textdelta(baton, None, self.pool)