##// END OF EJS Templates
convert/svn: do not try converting empty head revisions (issue3347)...
Patrick Mezard -
r16466:c53a49c3 stable
parent child Browse files
Show More
@@ -0,0 +1,129 b''
1 SVN-fs-dump-format-version: 2
2
3 UUID: b70c45d5-2b76-4722-a373-d9babae61626
4
5 Revision-number: 0
6 Prop-content-length: 260
7 Content-length: 260
8
9 K 8
10 svn:date
11 V 27
12 2012-04-18T11:35:14.752409Z
13 K 17
14 svn:sync-from-url
15 V 73
16 file:///Users/pmezard/dev/hg/hg-pmezard/tests/svn/temp/svn-repo/trunk/dir
17 K 18
18 svn:sync-from-uuid
19 V 36
20 56625b9e-e7e9-45be-ab61-052d41f0e1dd
21 K 24
22 svn:sync-last-merged-rev
23 V 1
24 4
25 PROPS-END
26
27 Revision-number: 1
28 Prop-content-length: 112
29 Content-length: 112
30
31 K 10
32 svn:author
33 V 7
34 pmezard
35 K 8
36 svn:date
37 V 27
38 2012-04-18T11:35:14.769622Z
39 K 7
40 svn:log
41 V 10
42 init projA
43 PROPS-END
44
45 Node-path: trunk
46 Node-kind: dir
47 Node-action: add
48 Prop-content-length: 10
49 Content-length: 10
50
51 PROPS-END
52
53
54 Revision-number: 2
55 Prop-content-length: 107
56 Content-length: 107
57
58 K 10
59 svn:author
60 V 7
61 pmezard
62 K 8
63 svn:date
64 V 27
65 2012-04-18T11:35:15.052989Z
66 K 7
67 svn:log
68 V 6
69 adddir
70 PROPS-END
71
72 Node-path: trunk/dir
73 Node-kind: dir
74 Node-action: add
75 Prop-content-length: 10
76 Content-length: 10
77
78 PROPS-END
79
80
81 Node-path: trunk/dir/a
82 Node-kind: file
83 Node-action: add
84 Prop-content-length: 10
85 Text-content-length: 2
86 Text-content-md5: 60b725f10c9c85c70d97880dfe8191b3
87 Text-content-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
88 Content-length: 12
89
90 PROPS-END
91 a
92
93
94 Revision-number: 3
95 Prop-content-length: 105
96 Content-length: 105
97
98 K 10
99 svn:author
100 V 7
101 pmezard
102 K 8
103 svn:date
104 V 27
105 2012-04-18T11:35:16.050353Z
106 K 7
107 svn:log
108 V 4
109 addb
110 PROPS-END
111
112 Revision-number: 4
113 Prop-content-length: 105
114 Content-length: 105
115
116 K 10
117 svn:author
118 V 7
119 pmezard
120 K 8
121 svn:date
122 V 27
123 2012-04-18T11:35:17.050768Z
124 K 7
125 svn:log
126 V 4
127 addc
128 PROPS-END
129
@@ -0,0 +1,47 b''
1 #!/bin/sh
2 #
3 # Use this script to generate empty.svndump
4 #
5
6 mkdir temp
7 cd temp
8
9 mkdir project-orig
10 cd project-orig
11 mkdir trunk
12 mkdir branches
13 mkdir tags
14 cd ..
15
16 svnadmin create svn-repo
17 svnurl=file://`pwd`/svn-repo
18 svn import project-orig $svnurl -m "init projA"
19
20 svn co $svnurl project
21 cd project
22 mkdir trunk/dir
23 echo a > trunk/dir/a
24 svn add trunk/dir
25 svn ci -m adddir
26
27 echo b > trunk/b
28 svn add trunk/b
29 svn ci -m addb
30
31 echo c > c
32 svn add c
33 svn ci -m addc
34 cd ..
35
36 # svnsync repo/trunk/dir only so the last two revisions are empty
37 svnadmin create svn-empty
38 cat > svn-empty/hooks/pre-revprop-change <<EOF
39 #!/bin/sh
40 exit 0
41 EOF
42 chmod +x svn-empty/hooks/pre-revprop-change
43 svnsync init --username svnsync file://`pwd`/svn-empty file://`pwd`/svn-repo/trunk/dir
44 svnsync sync file://`pwd`/svn-empty
45 svn log -v file://`pwd`/svn-empty
46
47 svnadmin dump svn-empty > ../empty.svndump
@@ -563,11 +563,15 b' class svn_source(converter_source):'
563 reported. Return None if computed module does not belong to
563 reported. Return None if computed module does not belong to
564 rootmodule subtree.
564 rootmodule subtree.
565 """
565 """
566 def findchanges(path, start, stop):
566 def findchanges(path, start, stop=None):
567 stream = self._getlog([path], start, stop)
567 stream = self._getlog([path], start, stop or 1)
568 try:
568 try:
569 for entry in stream:
569 for entry in stream:
570 paths, revnum, author, date, message = entry
570 paths, revnum, author, date, message = entry
571 if stop is None and paths:
572 # We do not know the latest changed revision,
573 # keep the first one with changed paths.
574 break
571 if revnum <= stop:
575 if revnum <= stop:
572 break
576 break
573
577
@@ -580,6 +584,8 b' class svn_source(converter_source):'
580 (path, newpath, revnum))
584 (path, newpath, revnum))
581 path = newpath
585 path = newpath
582 break
586 break
587 if not paths:
588 revnum = None
583 return revnum, path
589 return revnum, path
584 finally:
590 finally:
585 stream.close()
591 stream.close()
@@ -605,6 +611,19 b' class svn_source(converter_source):'
605 # development, but it might be in *another module*. Fetch the
611 # development, but it might be in *another module*. Fetch the
606 # log and detect renames down to the latest revision.
612 # log and detect renames down to the latest revision.
607 revnum, realpath = findchanges(path, stop, dirent.created_rev)
613 revnum, realpath = findchanges(path, stop, dirent.created_rev)
614 if revnum is None:
615 # Tools like svnsync can create empty revision, when
616 # synchronizing only a subtree for instance. These empty
617 # revisions created_rev still have their original values
618 # despite all changes having disappeared and can be
619 # returned by ra.stat(), at least when stating the root
620 # module. In that case, do not trust created_rev and scan
621 # the whole history.
622 revnum, realpath = findchanges(path, stop)
623 if revnum is None:
624 self.ui.debug('ignoring empty branch %r\n' % realpath)
625 return None
626
608 if not realpath.startswith(self.rootmodule):
627 if not realpath.startswith(self.rootmodule):
609 self.ui.debug('ignoring foreign branch %r\n' % realpath)
628 self.ui.debug('ignoring foreign branch %r\n' % realpath)
610 return None
629 return None
@@ -187,3 +187,24 b' This is also the only place testing more'
187 extra: branch=default
187 extra: branch=default
188 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
188 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
189 $ cd ..
189 $ cd ..
190
191 Test converting empty heads (issue3347)
192
193 $ svnadmin create svn-empty
194 $ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
195 $ hg --config convert.svn.trunk= convert svn-empty
196 assuming destination svn-empty-hg
197 initializing destination svn-empty-hg repository
198 scanning source...
199 sorting...
200 converting...
201 1 init projA
202 0 adddir
203 $ hg --config convert.svn.trunk= convert file://$svnpath/svn-empty/trunk
204 assuming destination trunk-hg
205 initializing destination trunk-hg repository
206 scanning source...
207 sorting...
208 converting...
209 1 init projA
210 0 adddir
General Comments 0
You need to be logged in to leave comments. Login now