Show More
@@ -725,6 +725,9 b' class svn_sink(converter_sink, commandli' | |||||
725 | converter_sink.__init__(self, ui, path) |
|
725 | converter_sink.__init__(self, ui, path) | |
726 | commandline.__init__(self, ui, 'svn') |
|
726 | commandline.__init__(self, ui, 'svn') | |
727 | self.delete = [] |
|
727 | self.delete = [] | |
|
728 | self.setexec = [] | |||
|
729 | self.delexec = [] | |||
|
730 | self.copies = [] | |||
728 | self.wc = None |
|
731 | self.wc = None | |
729 | self.cwd = os.getcwd() |
|
732 | self.cwd = os.getcwd() | |
730 |
|
733 | |||
@@ -792,15 +795,18 b' class svn_sink(converter_sink, commandli' | |||||
792 | util.set_exec(self.wjoin(filename), 'x' in flags) |
|
795 | util.set_exec(self.wjoin(filename), 'x' in flags) | |
793 | if was_exec: |
|
796 | if was_exec: | |
794 | if 'x' not in flags: |
|
797 | if 'x' not in flags: | |
795 |
self. |
|
798 | self.delexec.append(filename) | |
796 | else: |
|
799 | else: | |
797 | if 'x' in flags: |
|
800 | if 'x' in flags: | |
798 |
self. |
|
801 | self.setexec.append(filename) | |
799 |
|
802 | |||
800 | def delfile(self, name): |
|
803 | def delfile(self, name): | |
801 | self.delete.append(name) |
|
804 | self.delete.append(name) | |
802 |
|
805 | |||
803 | def copyfile(self, source, dest): |
|
806 | def copyfile(self, source, dest): | |
|
807 | self.copies.append([source, dest]) | |||
|
808 | ||||
|
809 | def _copyfile(self, source, dest): | |||
804 | # SVN's copy command pukes if the destination file exists, but |
|
810 | # SVN's copy command pukes if the destination file exists, but | |
805 | # our copyfile method expects to record a copy that has |
|
811 | # our copyfile method expects to record a copy that has | |
806 | # already occurred. Cross the semantic gap. |
|
812 | # already occurred. Cross the semantic gap. | |
@@ -831,15 +837,18 b' class svn_sink(converter_sink, commandli' | |||||
831 | dirs.add(f[:i]) |
|
837 | dirs.add(f[:i]) | |
832 | return dirs |
|
838 | return dirs | |
833 |
|
839 | |||
834 |
def add_ |
|
840 | def add_dirs(self, files): | |
835 | add_dirs = [d for d in self.dirs_of(files) |
|
841 | add_dirs = [d for d in self.dirs_of(files) | |
836 | if not os.path.exists(self.wjoin(d, '.svn', 'entries'))] |
|
842 | if not os.path.exists(self.wjoin(d, '.svn', 'entries'))] | |
837 | if add_dirs: |
|
843 | if add_dirs: | |
838 | add_dirs.sort() |
|
844 | add_dirs.sort() | |
839 | self.run('add', non_recursive=True, quiet=True, *add_dirs) |
|
845 | self.run('add', non_recursive=True, quiet=True, *add_dirs) | |
|
846 | return add_dirs | |||
|
847 | ||||
|
848 | def add_files(self, files): | |||
840 | if files: |
|
849 | if files: | |
841 | self.run('add', quiet=True, *files) |
|
850 | self.run('add', quiet=True, *files) | |
842 |
return files |
|
851 | return files | |
843 |
|
852 | |||
844 | def tidy_dirs(self, names): |
|
853 | def tidy_dirs(self, names): | |
845 | dirs = list(self.dirs_of(names)) |
|
854 | dirs = list(self.dirs_of(names)) | |
@@ -857,7 +866,7 b' class svn_sink(converter_sink, commandli' | |||||
857 |
|
866 | |||
858 | def revid(self, rev): |
|
867 | def revid(self, rev): | |
859 | return u"svn:%s@%s" % (self.uuid, rev) |
|
868 | return u"svn:%s@%s" % (self.uuid, rev) | |
860 |
|
869 | |||
861 | def putcommit(self, files, parents, commit): |
|
870 | def putcommit(self, files, parents, commit): | |
862 | for parent in parents: |
|
871 | for parent in parents: | |
863 | try: |
|
872 | try: | |
@@ -865,12 +874,24 b' class svn_sink(converter_sink, commandli' | |||||
865 | except KeyError: |
|
874 | except KeyError: | |
866 | pass |
|
875 | pass | |
867 | entries = set(self.delete) |
|
876 | entries = set(self.delete) | |
|
877 | files = util.frozenset(files) | |||
|
878 | entries.update(self.add_dirs(files.difference(entries))) | |||
|
879 | if self.copies: | |||
|
880 | for s, d in self.copies: | |||
|
881 | self._copyfile(s, d) | |||
|
882 | self.copies = [] | |||
868 | if self.delete: |
|
883 | if self.delete: | |
869 | self.run0('delete', *self.delete) |
|
884 | self.run0('delete', *self.delete) | |
870 | self.delete = [] |
|
885 | self.delete = [] | |
871 | files = util.frozenset(files) |
|
|||
872 | entries.update(self.add_files(files.difference(entries))) |
|
886 | entries.update(self.add_files(files.difference(entries))) | |
873 | entries.update(self.tidy_dirs(entries)) |
|
887 | entries.update(self.tidy_dirs(entries)) | |
|
888 | if self.delexec: | |||
|
889 | self.run0('propdel', 'svn:executable', *self.delexec) | |||
|
890 | self.delexec = [] | |||
|
891 | if self.setexec: | |||
|
892 | self.run0('propset', 'svn:executable', '*', *self.setexec) | |||
|
893 | self.setexec = [] | |||
|
894 | ||||
874 | fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') |
|
895 | fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') | |
875 | fp = os.fdopen(fd, 'w') |
|
896 | fp = os.fdopen(fd, 'w') | |
876 | fp.write(commit.desc) |
|
897 | fp.write(commit.desc) |
@@ -59,6 +59,29 b' hg convert -d svn a' | |||||
59 | (cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,') |
|
59 | (cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,') | |
60 | test -x a-hg-wc/c && echo executable || echo not executable |
|
60 | test -x a-hg-wc/c && echo executable || echo not executable | |
61 |
|
61 | |||
|
62 | echo % executable in new directory | |||
|
63 | ||||
|
64 | rm -rf a a-hg a-hg-wc | |||
|
65 | hg init a | |||
|
66 | ||||
|
67 | mkdir a/d1 | |||
|
68 | echo a > a/d1/a | |||
|
69 | chmod +x a/d1/a | |||
|
70 | hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' | |||
|
71 | ||||
|
72 | hg convert -d svn a | |||
|
73 | (cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,') | |||
|
74 | test -x a-hg-wc/d1/a && echo executable || echo not executable | |||
|
75 | ||||
|
76 | echo % copy to new directory | |||
|
77 | ||||
|
78 | mkdir a/d2 | |||
|
79 | hg --cwd a cp d1/a d2/a | |||
|
80 | hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' | |||
|
81 | ||||
|
82 | hg convert -d svn a | |||
|
83 | (cd a-hg-wc; svn up; svn st -v; svn log --xml -v --limit=1 | sed 's,<date>.*,<date/>,') | |||
|
84 | ||||
62 | echo % branchy history |
|
85 | echo % branchy history | |
63 |
|
86 | |||
64 | hg init b |
|
87 | hg init b |
@@ -195,6 +195,65 b' At revision 5.' | |||||
195 | </logentry> |
|
195 | </logentry> | |
196 | </log> |
|
196 | </log> | |
197 | executable |
|
197 | executable | |
|
198 | % executable in new directory | |||
|
199 | adding d1/a | |||
|
200 | assuming destination a-hg | |||
|
201 | initializing svn repo 'a-hg' | |||
|
202 | initializing svn wc 'a-hg-wc' | |||
|
203 | scanning source... | |||
|
204 | sorting... | |||
|
205 | converting... | |||
|
206 | 0 add executable file in new directory | |||
|
207 | At revision 1. | |||
|
208 | 1 1 test . | |||
|
209 | 1 1 test d1 | |||
|
210 | 1 1 test d1/a | |||
|
211 | <?xml version="1.0"?> | |||
|
212 | <log> | |||
|
213 | <logentry | |||
|
214 | revision="1"> | |||
|
215 | <author>test</author> | |||
|
216 | <date/> | |||
|
217 | <paths> | |||
|
218 | <path | |||
|
219 | action="A">/d1</path> | |||
|
220 | <path | |||
|
221 | action="A">/d1/a</path> | |||
|
222 | </paths> | |||
|
223 | <msg>add executable file in new directory</msg> | |||
|
224 | </logentry> | |||
|
225 | </log> | |||
|
226 | executable | |||
|
227 | % copy to new directory | |||
|
228 | assuming destination a-hg | |||
|
229 | initializing svn wc 'a-hg-wc' | |||
|
230 | scanning source... | |||
|
231 | sorting... | |||
|
232 | converting... | |||
|
233 | 0 copy file to new directory | |||
|
234 | At revision 2. | |||
|
235 | 2 2 test . | |||
|
236 | 2 1 test d1 | |||
|
237 | 2 1 test d1/a | |||
|
238 | 2 2 test d2 | |||
|
239 | 2 2 test d2/a | |||
|
240 | <?xml version="1.0"?> | |||
|
241 | <log> | |||
|
242 | <logentry | |||
|
243 | revision="2"> | |||
|
244 | <author>test</author> | |||
|
245 | <date/> | |||
|
246 | <paths> | |||
|
247 | <path | |||
|
248 | action="A">/d2</path> | |||
|
249 | <path | |||
|
250 | copyfrom-path="/d1/a" | |||
|
251 | copyfrom-rev="1" | |||
|
252 | action="A">/d2/a</path> | |||
|
253 | </paths> | |||
|
254 | <msg>copy file to new directory</msg> | |||
|
255 | </logentry> | |||
|
256 | </log> | |||
198 | % branchy history |
|
257 | % branchy history | |
199 | adding b |
|
258 | adding b | |
200 | adding left-1 |
|
259 | adding left-1 |
General Comments 0
You need to be logged in to leave comments.
Login now