##// END OF EJS Templates
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque -
r6079:ea34059b default
parent child Browse files
Show More
@@ -0,0 +1,66 b''
1 #!/bin/sh
2
3 "$TESTDIR/hghave" tla || exit 80
4
5 echo "[extensions]" >> $HGRCPATH
6 echo "convert=" >> $HGRCPATH
7 echo 'hgext.graphlog =' >> $HGRCPATH
8
9 echo % create tla archive
10 tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
11
12 echo % initialize tla repo
13 mkdir tla-repo
14 cd tla-repo/
15 tla init-tree tla@mercurial--convert/tla--test--0
16 tla import
17
18 echo % create initial files
19 echo 'this is a file' > a
20 tla add a
21 mkdir src
22 tla add src
23 cd src
24 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
25 tla add b
26 tla commit -s "added a file, src and src/b (binary)"
27
28 echo % create link file and modify a
29 ln -s ../a a-link
30 tla add a-link
31 echo 'this a modification to a' >> ../a
32 tla commit -s "added link to a and modify a"
33
34 echo % create second link and modify b
35 ln -s ../a a-link-2
36 tla add a-link-2
37 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
38 tla commit -s "added second link and modify b"
39
40 echo % b file to link and a-link-2 to regular file
41 rm -f a-link-2
42 echo 'this is now a regular file' > a-link-2
43 ln -sf ../a b
44 tla commit -s "file to link and link to file test"
45
46 echo % move a-link-2 file and src directory
47 cd ..
48 tla mv src/a-link-2 c
49 tla mv src test
50 tla commit -s "move and rename a-link-2 file and src directory"
51
52 cd ..
53
54 echo % converting tla repo to Mercurial
55 hg convert tla-repo tla-repo-hg
56
57 tla register-archive -d tla@mercurial--convert
58
59 glog()
60 {
61 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
62 }
63
64 echo % show graph log
65 glog -R tla-repo-hg
66 hg -R tla-repo-hg manifest --debug
@@ -0,0 +1,72 b''
1 % create tla archive
2 % initialize tla repo
3 * creating version tla@mercurial--convert/tla--test--0
4 * imported tla@mercurial--convert/tla--test--0
5 % create initial files
6 A/ .arch-ids
7 A/ src
8 A/ src/.arch-ids
9 A .arch-ids/a.id
10 A a
11 A src/.arch-ids/=id
12 A src/.arch-ids/b.id
13 A src/b
14 * update pristine tree (tla@mercurial--convert/tla--test--0--base-0 => tla--test--0--patch-1)
15 * committed tla@mercurial--convert/tla--test--0--patch-1
16 % create link file and modify a
17 A src/.arch-ids/a-link.id
18 A src/a-link
19 M a
20 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-1 => tla--test--0--patch-2)
21 * committed tla@mercurial--convert/tla--test--0--patch-2
22 % create second link and modify b
23 A src/.arch-ids/a-link-2.id
24 A src/a-link-2
25 Mb src/b
26 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-2 => tla--test--0--patch-3)
27 * committed tla@mercurial--convert/tla--test--0--patch-3
28 % b file to link and a-link-2 to regular file
29 fl src/b
30 lf src/a-link-2
31 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-3 => tla--test--0--patch-4)
32 * committed tla@mercurial--convert/tla--test--0--patch-4
33 % move a-link-2 file and src directory
34 D/ src/.arch-ids
35 A/ test/.arch-ids
36 /> src test
37 => src/.arch-ids/a-link-2.id .arch-ids/c.id
38 => src/a-link-2 c
39 => src/.arch-ids/=id test/.arch-ids/=id
40 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
41 => src/.arch-ids/b.id test/.arch-ids/b.id
42 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-4 => tla--test--0--patch-5)
43 * committed tla@mercurial--convert/tla--test--0--patch-5
44 % converting tla repo to Mercurial
45 initializing destination tla-repo-hg repository
46 analyzing tree version tla@mercurial--convert/tla--test--0...
47 scanning source...
48 sorting...
49 converting...
50 5 initial import
51 4 added a file, src and src/b (binary)
52 3 added link to a and modify a
53 2 added second link and modify b
54 1 file to link and link to file test
55 0 move and rename a-link-2 file and src directory
56 % show graph log
57 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
58 |
59 o 4 "file to link and link to file test" files: src/a-link-2 src/b
60 |
61 o 3 "added second link and modify b" files: src/a-link-2 src/b
62 |
63 o 2 "added link to a and modify a" files: a src/a-link
64 |
65 o 1 "added a file, src and src/b (binary)" files: a src/b
66 |
67 o 0 "initial import" files:
68
69 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
70 e3207be798aaf87a444a62903621edab4ddc1fb6 644 c
71 1f6b5bb93f1da278ef1fead1e4740a03d8802e9f 644 @ test/a-link
72 1f6b5bb93f1da278ef1fead1e4740a03d8802e9f 644 @ test/b
@@ -227,6 +227,11 b' class gnuarch_source(converter_source, c'
227 files = self._readcontents(self.tmppath)
227 files = self._readcontents(self.tmppath)
228 self.changes[rev].add_files += files
228 self.changes[rev].add_files += files
229
229
230 def _stripbasepath(self, path):
231 if path.startswith('./'):
232 return path[2:]
233 return path
234
230 def _parsecatlog(self, data, rev):
235 def _parsecatlog(self, data, rev):
231 summary = []
236 summary = []
232 for l in data:
237 for l in data:
@@ -248,27 +253,27 b' class gnuarch_source(converter_source, c'
248 l = l.strip()
253 l = l.strip()
249 # Added file (ignore added directory)
254 # Added file (ignore added directory)
250 if l.startswith('A') and not l.startswith('A/'):
255 if l.startswith('A') and not l.startswith('A/'):
251 file = l[1:].strip()
256 file = self._stripbasepath(l[1:].strip())
252 if not self._exclude(file):
257 if not self._exclude(file):
253 self.changes[rev].add_files.append(file)
258 self.changes[rev].add_files.append(file)
254 # Deleted file (ignore deleted directory)
259 # Deleted file (ignore deleted directory)
255 elif l.startswith('D') and not l.startswith('D/'):
260 elif l.startswith('D') and not l.startswith('D/'):
256 file = l[1:].strip()
261 file = self._stripbasepath(l[1:].strip())
257 if not self._exclude(file):
262 if not self._exclude(file):
258 self.changes[rev].del_files.append(file)
263 self.changes[rev].del_files.append(file)
259 # Modified binary file
264 # Modified binary file
260 elif l.startswith('Mb'):
265 elif l.startswith('Mb'):
261 file = l[2:].strip()
266 file = self._stripbasepath(l[2:].strip())
262 if not self._exclude(file):
267 if not self._exclude(file):
263 self.changes[rev].mod_files.append(file)
268 self.changes[rev].mod_files.append(file)
264 # Modified link
269 # Modified link
265 elif l.startswith('M->'):
270 elif l.startswith('M->'):
266 file = l[3:].strip()
271 file = self._stripbasepath(l[3:].strip())
267 if not self._exclude(file):
272 if not self._exclude(file):
268 self.changes[rev].mod_files.append(file)
273 self.changes[rev].mod_files.append(file)
269 # Modified file
274 # Modified file
270 elif l.startswith('M'):
275 elif l.startswith('M'):
271 file = l[1:].strip()
276 file = self._stripbasepath(l[1:].strip())
272 if not self._exclude(file):
277 if not self._exclude(file):
273 self.changes[rev].mod_files.append(file)
278 self.changes[rev].mod_files.append(file)
274 # Renamed file (or link)
279 # Renamed file (or link)
@@ -276,11 +281,13 b' class gnuarch_source(converter_source, c'
276 files = l[2:].strip().split(' ')
281 files = l[2:].strip().split(' ')
277 if len(files) == 1:
282 if len(files) == 1:
278 files = l[2:].strip().split('\t')
283 files = l[2:].strip().split('\t')
279 if not self._exclude(files[0]) and not self._exclude(files[1]):
284 src = self._stripbasepath(files[0])
280 self.changes[rev].ren_files[files[0]] = files[1]
285 dst = self._stripbasepath(files[1])
286 if not self._exclude(src) and not self._exclude(dst):
287 self.changes[rev].ren_files[src] = dst
281 # Conversion from file to link or from link to file (modified)
288 # Conversion from file to link or from link to file (modified)
282 elif l.startswith('ch'):
289 elif l.startswith('ch'):
283 file = l[2:].strip()
290 file = self._stripbasepath(l[2:].strip())
284 if not self._exclude(file):
291 if not self._exclude(file):
285 self.changes[rev].mod_files.append(file)
292 self.changes[rev].mod_files.append(file)
286 # Renamed directory
293 # Renamed directory
@@ -288,5 +295,7 b' class gnuarch_source(converter_source, c'
288 dirs = l[2:].strip().split(' ')
295 dirs = l[2:].strip().split(' ')
289 if len(dirs) == 1:
296 if len(dirs) == 1:
290 dirs = l[2:].strip().split('\t')
297 dirs = l[2:].strip().split('\t')
291 if not self._exclude(dirs[0]) and not self._exclude(dirs[1]):
298 src = self._stripbasepath(dirs[0])
292 self.changes[rev].ren_dirs[dirs[0]] = dirs[1]
299 dst = self._stripbasepath(dirs[1])
300 if not self._exclude(src) and not self._exclude(dst):
301 self.changes[rev].ren_dirs[src] = dst
@@ -88,6 +88,9 b' def has_svn_bindings():'
88 def has_symlink():
88 def has_symlink():
89 return hasattr(os, "symlink")
89 return hasattr(os, "symlink")
90
90
91 def has_tla():
92 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
93
91 def has_unix_permissions():
94 def has_unix_permissions():
92 d = tempfile.mkdtemp(prefix=tempprefix, dir=".")
95 d = tempfile.mkdtemp(prefix=tempprefix, dir=".")
93 try:
96 try:
@@ -118,6 +121,7 b' checks = {'
118 "svn": (has_svn, "subversion client and admin tools"),
121 "svn": (has_svn, "subversion client and admin tools"),
119 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
122 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
120 "symlink": (has_symlink, "symbolic links"),
123 "symlink": (has_symlink, "symbolic links"),
124 "tla": (has_tla, "GNU Arch tla client"),
121 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
125 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
122 }
126 }
123
127
General Comments 0
You need to be logged in to leave comments. Login now