##// END OF EJS Templates
convert: parse perforce data on-demand...
David Soria Parra -
r30632:1d0e4832 default
parent child Browse files
Show More
@@ -1,358 +1,368
1 1 # Perforce source for convert extension.
2 2 #
3 3 # Copyright 2009, Frank Kingswood <frank@kingswood-consulting.co.uk>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7 from __future__ import absolute_import
8 8
9 9 import marshal
10 10 import re
11 11
12 12 from mercurial.i18n import _
13 13 from mercurial import (
14 14 error,
15 15 util,
16 16 )
17 17
18 18 from . import common
19 19
20 20 def loaditer(f):
21 21 "Yield the dictionary objects generated by p4"
22 22 try:
23 23 while True:
24 24 d = marshal.load(f)
25 25 if not d:
26 26 break
27 27 yield d
28 28 except EOFError:
29 29 pass
30 30
31 31 def decodefilename(filename):
32 32 """Perforce escapes special characters @, #, *, or %
33 33 with %40, %23, %2A, or %25 respectively
34 34
35 35 >>> decodefilename('portable-net45%252Bnetcore45%252Bwp8%252BMonoAndroid')
36 36 'portable-net45%2Bnetcore45%2Bwp8%2BMonoAndroid'
37 37 >>> decodefilename('//Depot/Directory/%2525/%2523/%23%40.%2A')
38 38 '//Depot/Directory/%25/%23/#@.*'
39 39 """
40 40 replacements = [('%2A', '*'), ('%23', '#'), ('%40', '@'), ('%25', '%')]
41 41 for k, v in replacements:
42 42 filename = filename.replace(k, v)
43 43 return filename
44 44
45 45 class p4_source(common.converter_source):
46 46 def __init__(self, ui, path, revs=None):
47 47 # avoid import cycle
48 48 from . import convcmd
49 49
50 50 super(p4_source, self).__init__(ui, path, revs=revs)
51 51
52 52 if "/" in path and not path.startswith('//'):
53 53 raise common.NoRepo(_('%s does not look like a P4 repository') %
54 54 path)
55 55
56 56 common.checktool('p4', abort=False)
57 57
58 58 self.revmap = {}
59 self.heads = []
60 self.changeset = {}
61 self.files = {}
62 self.copies = {}
63 59 self.encoding = self.ui.config('convert', 'p4.encoding',
64 60 default=convcmd.orig_encoding)
65 self.depotname = {} # mapping from local name to depot name
66 61 self.re_type = re.compile(
67 62 "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
68 63 "(\+\w+)?$")
69 64 self.re_keywords = re.compile(
70 65 r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
71 66 r":[^$\n]*\$")
72 67 self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$")
73 68
74 69 if revs and len(revs) > 1:
75 70 raise error.Abort(_("p4 source does not support specifying "
76 71 "multiple revisions"))
77 self._parse_once(ui, path)
78 72
79 73 def setrevmap(self, revmap):
80 74 """Sets the parsed revmap dictionary.
81 75
82 76 Revmap stores mappings from a source revision to a target revision.
83 77 It is set in convertcmd.convert and provided by the user as a file
84 78 on the commandline.
85 79
86 80 Revisions in the map are considered beeing present in the
87 81 repository and ignored during _parse(). This allows for incremental
88 82 imports if a revmap is provided.
89 83 """
90 84 self.revmap = revmap
91 85
92 86 def _parse_view(self, path):
93 87 "Read changes affecting the path"
94 88 cmd = 'p4 -G changes -s submitted %s' % util.shellquote(path)
95 89 stdout = util.popen(cmd, mode='rb')
96 90 p4changes = {}
97 91 for d in loaditer(stdout):
98 92 c = d.get("change", None)
99 93 if c:
100 94 p4changes[c] = True
101 95 return p4changes
102 96
103 97 def _parse(self, ui, path):
104 98 "Prepare list of P4 filenames and revisions to import"
105 99 p4changes = {}
106 100 changeset = {}
107 101 files_map = {}
108 102 copies_map = {}
109 103 localname = {}
110 104 depotname = {}
111 105 heads = []
112 106
113 107 ui.status(_('reading p4 views\n'))
114 108
115 109 # read client spec or view
116 110 if "/" in path:
117 111 p4changes.update(self._parse_view(path))
118 112 if path.startswith("//") and path.endswith("/..."):
119 113 views = {path[:-3]:""}
120 114 else:
121 115 views = {"//": ""}
122 116 else:
123 117 cmd = 'p4 -G client -o %s' % util.shellquote(path)
124 118 clientspec = marshal.load(util.popen(cmd, mode='rb'))
125 119
126 120 views = {}
127 121 for client in clientspec:
128 122 if client.startswith("View"):
129 123 sview, cview = clientspec[client].split()
130 124 p4changes.update(self._parse_view(sview))
131 125 if sview.endswith("...") and cview.endswith("..."):
132 126 sview = sview[:-3]
133 127 cview = cview[:-3]
134 128 cview = cview[2:]
135 129 cview = cview[cview.find("/") + 1:]
136 130 views[sview] = cview
137 131
138 132 # list of changes that affect our source files
139 133 p4changes = p4changes.keys()
140 134 p4changes.sort(key=int)
141 135
142 136 # list with depot pathnames, longest first
143 137 vieworder = views.keys()
144 138 vieworder.sort(key=len, reverse=True)
145 139
146 140 # handle revision limiting
147 141 startrev = self.ui.config('convert', 'p4.startrev', default=0)
148 142
149 143 # now read the full changelists to get the list of file revisions
150 144 ui.status(_('collecting p4 changelists\n'))
151 145 lastid = None
152 146 for change in p4changes:
153 147 if startrev and int(change) < int(startrev):
154 148 continue
155 149 if self.revs and int(change) > int(self.revs[0]):
156 150 continue
157 151 if change in self.revmap:
158 152 # Ignore already present revisions, but set the parent pointer.
159 153 lastid = change
160 154 continue
161 155
162 156 if lastid:
163 157 parents = [lastid]
164 158 else:
165 159 parents = []
166 160
167 161 d = self._fetch_revision(change)
168 162 c = self._construct_commit(d, parents)
169 163
170 164 shortdesc = c.desc.splitlines(True)[0].rstrip('\r\n')
171 165 t = '%s %s' % (c.rev, repr(shortdesc)[1:-1])
172 166 ui.status(util.ellipsis(t, 80) + '\n')
173 167
174 168 files = []
175 169 copies = {}
176 170 copiedfiles = []
177 171 i = 0
178 172 while ("depotFile%d" % i) in d and ("rev%d" % i) in d:
179 173 oldname = d["depotFile%d" % i]
180 174 filename = None
181 175 for v in vieworder:
182 176 if oldname.lower().startswith(v.lower()):
183 177 filename = decodefilename(views[v] + oldname[len(v):])
184 178 break
185 179 if filename:
186 180 files.append((filename, d["rev%d" % i]))
187 181 depotname[filename] = oldname
188 182 if (d.get("action%d" % i) == "move/add"):
189 183 copiedfiles.append(filename)
190 184 localname[oldname] = filename
191 185 i += 1
192 186
193 187 # Collect information about copied files
194 188 for filename in copiedfiles:
195 189 oldname = depotname[filename]
196 190
197 191 flcmd = 'p4 -G filelog %s' \
198 192 % util.shellquote(oldname)
199 193 flstdout = util.popen(flcmd, mode='rb')
200 194
201 195 copiedfilename = None
202 196 for d in loaditer(flstdout):
203 197 copiedoldname = None
204 198
205 199 i = 0
206 200 while ("change%d" % i) in d:
207 201 if (d["change%d" % i] == change and
208 202 d["action%d" % i] == "move/add"):
209 203 j = 0
210 204 while ("file%d,%d" % (i, j)) in d:
211 205 if d["how%d,%d" % (i, j)] == "moved from":
212 206 copiedoldname = d["file%d,%d" % (i, j)]
213 207 break
214 208 j += 1
215 209 i += 1
216 210
217 211 if copiedoldname and copiedoldname in localname:
218 212 copiedfilename = localname[copiedoldname]
219 213 break
220 214
221 215 if copiedfilename:
222 216 copies[filename] = copiedfilename
223 217 else:
224 218 ui.warn(_("cannot find source for copied file: %s@%s\n")
225 219 % (filename, change))
226 220
227 221 changeset[change] = c
228 222 files_map[change] = files
229 223 copies_map[change] = copies
230 224 lastid = change
231 225
232 226 if lastid and len(changeset) > 0:
233 227 heads = [lastid]
234 228
235 229 return {
236 230 'changeset': changeset,
237 231 'files': files_map,
238 232 'copies': copies_map,
239 233 'heads': heads,
240 234 'depotname': depotname,
241 235 }
242 236
243 def _parse_once(self, ui, path):
244 d = self._parse(ui, path)
245 self.changeset = d['changeset']
246 self.heads = d['heads']
247 self.files = d['files']
248 self.copies = d['copies']
249 self.depotname = d['depotname']
237 @util.propertycache
238 def _parse_once(self):
239 return self._parse(self.ui, self.path)
240
241 @util.propertycache
242 def copies(self):
243 return self._parse_once['copies']
244
245 @util.propertycache
246 def files(self):
247 return self._parse_once['files']
248
249 @util.propertycache
250 def changeset(self):
251 return self._parse_once['changeset']
252
253 @util.propertycache
254 def heads(self):
255 return self._parse_once['heads']
256
257 @util.propertycache
258 def depotname(self):
259 return self._parse_once['depotname']
250 260
251 261 def getheads(self):
252 262 return self.heads
253 263
254 264 def getfile(self, name, rev):
255 265 cmd = 'p4 -G print %s' \
256 266 % util.shellquote("%s#%s" % (self.depotname[name], rev))
257 267
258 268 lasterror = None
259 269 while True:
260 270 stdout = util.popen(cmd, mode='rb')
261 271
262 272 mode = None
263 273 contents = []
264 274 keywords = None
265 275
266 276 for d in loaditer(stdout):
267 277 code = d["code"]
268 278 data = d.get("data")
269 279
270 280 if code == "error":
271 281 # if this is the first time error happened
272 282 # re-attempt getting the file
273 283 if not lasterror:
274 284 lasterror = IOError(d["generic"], data)
275 285 # this will exit inner-most for-loop
276 286 break
277 287 else:
278 288 raise lasterror
279 289
280 290 elif code == "stat":
281 291 action = d.get("action")
282 292 if action in ["purge", "delete", "move/delete"]:
283 293 return None, None
284 294 p4type = self.re_type.match(d["type"])
285 295 if p4type:
286 296 mode = ""
287 297 flags = ((p4type.group(1) or "")
288 298 + (p4type.group(3) or ""))
289 299 if "x" in flags:
290 300 mode = "x"
291 301 if p4type.group(2) == "symlink":
292 302 mode = "l"
293 303 if "ko" in flags:
294 304 keywords = self.re_keywords_old
295 305 elif "k" in flags:
296 306 keywords = self.re_keywords
297 307
298 308 elif code == "text" or code == "binary":
299 309 contents.append(data)
300 310
301 311 lasterror = None
302 312
303 313 if not lasterror:
304 314 break
305 315
306 316 if mode is None:
307 317 return None, None
308 318
309 319 contents = ''.join(contents)
310 320
311 321 if keywords:
312 322 contents = keywords.sub("$\\1$", contents)
313 323 if mode == "l" and contents.endswith("\n"):
314 324 contents = contents[:-1]
315 325
316 326 return contents, mode
317 327
318 328 def getchanges(self, rev, full):
319 329 if full:
320 330 raise error.Abort(_("convert from p4 does not support --full"))
321 331 return self.files[rev], self.copies[rev], set()
322 332
323 333 def _construct_commit(self, obj, parents=None):
324 334 """
325 335 Constructs a common.commit object from an unmarshalled
326 336 `p4 describe` output
327 337 """
328 338 desc = self.recode(obj.get("desc", ""))
329 339 date = (int(obj["time"]), 0) # timezone not set
330 340 if parents is None:
331 341 parents = []
332 342
333 343 return common.commit(author=self.recode(obj["user"]),
334 344 date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'),
335 345 parents=parents, desc=desc, branch=None, rev=obj['change'],
336 346 extra={"p4": obj['change'], "convert_revision": obj['change']})
337 347
338 348 def _fetch_revision(self, rev):
339 349 """Return an output of `p4 describe` including author, commit date as
340 350 a dictionary."""
341 351 cmd = "p4 -G describe -s %s" % rev
342 352 stdout = util.popen(cmd, mode='rb')
343 353 return marshal.load(stdout)
344 354
345 355 def getcommit(self, rev):
346 356 if rev in self.changeset:
347 357 return self.changeset[rev]
348 358 elif rev in self.revmap:
349 359 d = self._fetch_revision(rev)
350 360 return self._construct_commit(d, parents=None)
351 361 raise error.Abort(
352 362 _("cannot find %s in the revmap or parsed changesets") % rev)
353 363
354 364 def gettags(self):
355 365 return {}
356 366
357 367 def getchangedfiles(self, rev, i):
358 368 return sorted([x[0] for x in self.files[rev]])
@@ -1,755 +1,755
1 1 #require p4 execbit symlink
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "convert = " >> $HGRCPATH
5 5
6 6 create p4 depot
7 7 $ P4ROOT=`pwd`/depot; export P4ROOT
8 8 $ P4AUDIT=$P4ROOT/audit; export P4AUDIT
9 9 $ P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
10 10 $ P4LOG=$P4ROOT/log; export P4LOG
11 11 $ P4PORT=localhost:$HGPORT; export P4PORT
12 12 $ P4DEBUG=1; export P4DEBUG
13 13 $ P4CHARSET=utf8; export P4CHARSET
14 14
15 15 start the p4 server
16 16 $ [ ! -d $P4ROOT ] && mkdir $P4ROOT
17 17 $ p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr
18 18 $ p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
19 19 $ echo $! >> $DAEMON_PIDS
20 20 $ trap "echo stopping the p4 server ; p4 admin stop" EXIT
21 21
22 22 wait for the server to initialize
23 23 $ while ! p4 ; do
24 24 > sleep 1
25 25 > done >/dev/null 2>/dev/null
26 26
27 27 create a client spec
28 28 $ P4CLIENT=hg-p4-import; export P4CLIENT
29 29 $ DEPOTPATH=//depot/test-mercurial-import/...
30 30 $ p4 client -o | sed '/^View:/,$ d' >p4client
31 31 $ echo View: >>p4client
32 32 $ echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
33 33 $ p4 client -i <p4client
34 34 Client hg-p4-import saved.
35 35
36 36 populate the depot
37 37 $ TYPES="text binary symlink"
38 38 $ TYPES="$TYPES text+m text+w text+x text+k text+kx text+ko text+l text+C text+D text+F text+S text+S2"
39 39 $ TYPES="$TYPES binary+k binary+x binary+kx symlink+k"
40 40 $ TYPES="$TYPES ctext cxtext ktext kxtext ltext tempobj ubinary uxbinary xbinary xltext xtempobj xtext"
41 41 not testing these
42 42 $ #TYPES="$TYPES apple resource unicode utf16 uresource xunicode xutf16"
43 43 $ for T in $TYPES ; do
44 44 > T2=`echo $T | tr [:upper:] [:lower:]`
45 45 > case $T in
46 46 > apple)
47 47 > ;;
48 48 > symlink*)
49 49 > echo "this is target $T" >target_$T2
50 50 > ln -s target_$T file_$T2
51 51 > p4 add target_$T2
52 52 > p4 add -t $T file_$T2
53 53 > ;;
54 54 > binary*)
55 55 > $PYTHON -c "file('file_$T2', 'wb').write('this is $T')"
56 56 > p4 add -t $T file_$T2
57 57 > ;;
58 58 > *)
59 59 > echo "this is $T" >file_$T2
60 60 > p4 add -t $T file_$T2
61 61 > ;;
62 62 > esac
63 63 > done
64 64 //depot/test-mercurial-import/file_text#1 - opened for add
65 65 //depot/test-mercurial-import/file_binary#1 - opened for add
66 66 //depot/test-mercurial-import/target_symlink#1 - opened for add
67 67 //depot/test-mercurial-import/file_symlink#1 - opened for add
68 68 //depot/test-mercurial-import/file_text+m#1 - opened for add
69 69 //depot/test-mercurial-import/file_text+w#1 - opened for add
70 70 //depot/test-mercurial-import/file_text+x#1 - opened for add
71 71 //depot/test-mercurial-import/file_text+k#1 - opened for add
72 72 //depot/test-mercurial-import/file_text+kx#1 - opened for add
73 73 //depot/test-mercurial-import/file_text+ko#1 - opened for add
74 74 //depot/test-mercurial-import/file_text+l#1 - opened for add
75 75 //depot/test-mercurial-import/file_text+c#1 - opened for add
76 76 //depot/test-mercurial-import/file_text+d#1 - opened for add
77 77 //depot/test-mercurial-import/file_text+f#1 - opened for add
78 78 //depot/test-mercurial-import/file_text+s#1 - opened for add
79 79 //depot/test-mercurial-import/file_text+s2#1 - opened for add
80 80 //depot/test-mercurial-import/file_binary+k#1 - opened for add
81 81 //depot/test-mercurial-import/file_binary+x#1 - opened for add
82 82 //depot/test-mercurial-import/file_binary+kx#1 - opened for add
83 83 //depot/test-mercurial-import/target_symlink+k#1 - opened for add
84 84 //depot/test-mercurial-import/file_symlink+k#1 - opened for add
85 85 //depot/test-mercurial-import/file_ctext#1 - opened for add
86 86 //depot/test-mercurial-import/file_cxtext#1 - opened for add
87 87 //depot/test-mercurial-import/file_ktext#1 - opened for add
88 88 //depot/test-mercurial-import/file_kxtext#1 - opened for add
89 89 //depot/test-mercurial-import/file_ltext#1 - opened for add
90 90 //depot/test-mercurial-import/file_tempobj#1 - opened for add
91 91 //depot/test-mercurial-import/file_ubinary#1 - opened for add
92 92 //depot/test-mercurial-import/file_uxbinary#1 - opened for add
93 93 //depot/test-mercurial-import/file_xbinary#1 - opened for add
94 94 //depot/test-mercurial-import/file_xltext#1 - opened for add
95 95 //depot/test-mercurial-import/file_xtempobj#1 - opened for add
96 96 //depot/test-mercurial-import/file_xtext#1 - opened for add
97 97 $ p4 submit -d initial
98 98 Submitting change 1.
99 99 Locking 33 files ...
100 100 add //depot/test-mercurial-import/file_binary#1
101 101 add //depot/test-mercurial-import/file_binary+k#1
102 102 add //depot/test-mercurial-import/file_binary+kx#1
103 103 add //depot/test-mercurial-import/file_binary+x#1
104 104 add //depot/test-mercurial-import/file_ctext#1
105 105 add //depot/test-mercurial-import/file_cxtext#1
106 106 add //depot/test-mercurial-import/file_ktext#1
107 107 add //depot/test-mercurial-import/file_kxtext#1
108 108 add //depot/test-mercurial-import/file_ltext#1
109 109 add //depot/test-mercurial-import/file_symlink#1
110 110 add //depot/test-mercurial-import/file_symlink+k#1
111 111 add //depot/test-mercurial-import/file_tempobj#1
112 112 add //depot/test-mercurial-import/file_text#1
113 113 add //depot/test-mercurial-import/file_text+c#1
114 114 add //depot/test-mercurial-import/file_text+d#1
115 115 add //depot/test-mercurial-import/file_text+f#1
116 116 add //depot/test-mercurial-import/file_text+k#1
117 117 add //depot/test-mercurial-import/file_text+ko#1
118 118 add //depot/test-mercurial-import/file_text+kx#1
119 119 add //depot/test-mercurial-import/file_text+l#1
120 120 add //depot/test-mercurial-import/file_text+m#1
121 121 add //depot/test-mercurial-import/file_text+s#1
122 122 add //depot/test-mercurial-import/file_text+s2#1
123 123 add //depot/test-mercurial-import/file_text+w#1
124 124 add //depot/test-mercurial-import/file_text+x#1
125 125 add //depot/test-mercurial-import/file_ubinary#1
126 126 add //depot/test-mercurial-import/file_uxbinary#1
127 127 add //depot/test-mercurial-import/file_xbinary#1
128 128 add //depot/test-mercurial-import/file_xltext#1
129 129 add //depot/test-mercurial-import/file_xtempobj#1
130 130 add //depot/test-mercurial-import/file_xtext#1
131 131 add //depot/test-mercurial-import/target_symlink#1
132 132 add //depot/test-mercurial-import/target_symlink+k#1
133 133 Change 1 submitted.
134 134 //depot/test-mercurial-import/file_binary+k#1 - refreshing
135 135 //depot/test-mercurial-import/file_binary+kx#1 - refreshing
136 136 //depot/test-mercurial-import/file_ktext#1 - refreshing
137 137 //depot/test-mercurial-import/file_kxtext#1 - refreshing
138 138 //depot/test-mercurial-import/file_symlink+k#1 - refreshing
139 139 //depot/test-mercurial-import/file_text+k#1 - refreshing
140 140 //depot/test-mercurial-import/file_text+ko#1 - refreshing
141 141 //depot/test-mercurial-import/file_text+kx#1 - refreshing
142 142
143 143 test keyword expansion
144 144 $ p4 edit file_* target_*
145 145 //depot/test-mercurial-import/file_binary#1 - opened for edit
146 146 //depot/test-mercurial-import/file_binary+k#1 - opened for edit
147 147 //depot/test-mercurial-import/file_binary+kx#1 - opened for edit
148 148 //depot/test-mercurial-import/file_binary+x#1 - opened for edit
149 149 //depot/test-mercurial-import/file_ctext#1 - opened for edit
150 150 //depot/test-mercurial-import/file_cxtext#1 - opened for edit
151 151 //depot/test-mercurial-import/file_ktext#1 - opened for edit
152 152 //depot/test-mercurial-import/file_kxtext#1 - opened for edit
153 153 //depot/test-mercurial-import/file_ltext#1 - opened for edit
154 154 //depot/test-mercurial-import/file_symlink#1 - opened for edit
155 155 //depot/test-mercurial-import/file_symlink+k#1 - opened for edit
156 156 //depot/test-mercurial-import/file_tempobj#1 - opened for edit
157 157 //depot/test-mercurial-import/file_text#1 - opened for edit
158 158 //depot/test-mercurial-import/file_text+c#1 - opened for edit
159 159 //depot/test-mercurial-import/file_text+d#1 - opened for edit
160 160 //depot/test-mercurial-import/file_text+f#1 - opened for edit
161 161 //depot/test-mercurial-import/file_text+k#1 - opened for edit
162 162 //depot/test-mercurial-import/file_text+ko#1 - opened for edit
163 163 //depot/test-mercurial-import/file_text+kx#1 - opened for edit
164 164 //depot/test-mercurial-import/file_text+l#1 - opened for edit
165 165 //depot/test-mercurial-import/file_text+m#1 - opened for edit
166 166 //depot/test-mercurial-import/file_text+s#1 - opened for edit
167 167 //depot/test-mercurial-import/file_text+s2#1 - opened for edit
168 168 //depot/test-mercurial-import/file_text+w#1 - opened for edit
169 169 //depot/test-mercurial-import/file_text+x#1 - opened for edit
170 170 //depot/test-mercurial-import/file_ubinary#1 - opened for edit
171 171 //depot/test-mercurial-import/file_uxbinary#1 - opened for edit
172 172 //depot/test-mercurial-import/file_xbinary#1 - opened for edit
173 173 //depot/test-mercurial-import/file_xltext#1 - opened for edit
174 174 //depot/test-mercurial-import/file_xtempobj#1 - opened for edit
175 175 //depot/test-mercurial-import/file_xtext#1 - opened for edit
176 176 //depot/test-mercurial-import/target_symlink#1 - opened for edit
177 177 //depot/test-mercurial-import/target_symlink+k#1 - opened for edit
178 178 $ for T in $TYPES ; do
179 179 > T2=`echo $T | tr [:upper:] [:lower:]`
180 180 > echo '$Id$' >>file_$T2
181 181 > echo '$Header$' >>file_$T2
182 182 > echo '$Date$' >>file_$T2
183 183 > echo '$DateTime$' >>file_$T2
184 184 > echo '$Change$' >>file_$T2
185 185 > echo '$File$' >>file_$T2
186 186 > echo '$Revision$' >>file_$T2
187 187 > echo '$Header$$Header$Header$' >>file_$T2
188 188 > done
189 189
190 190 $ ln -s 'target_$Header$' crazy_symlink+k
191 191 $ p4 add -t symlink+k crazy_symlink+k
192 192 //depot/test-mercurial-import/crazy_symlink+k#1 - opened for add
193 193
194 194 $ p4 submit -d keywords
195 195 Submitting change 2.
196 196 Locking 34 files ...
197 197 add //depot/test-mercurial-import/crazy_symlink+k#1
198 198 edit //depot/test-mercurial-import/file_binary#2
199 199 edit //depot/test-mercurial-import/file_binary+k#2
200 200 edit //depot/test-mercurial-import/file_binary+kx#2
201 201 edit //depot/test-mercurial-import/file_binary+x#2
202 202 edit //depot/test-mercurial-import/file_ctext#2
203 203 edit //depot/test-mercurial-import/file_cxtext#2
204 204 edit //depot/test-mercurial-import/file_ktext#2
205 205 edit //depot/test-mercurial-import/file_kxtext#2
206 206 edit //depot/test-mercurial-import/file_ltext#2
207 207 edit //depot/test-mercurial-import/file_symlink#2
208 208 edit //depot/test-mercurial-import/file_symlink+k#2
209 209 edit //depot/test-mercurial-import/file_tempobj#2
210 210 edit //depot/test-mercurial-import/file_text#2
211 211 edit //depot/test-mercurial-import/file_text+c#2
212 212 edit //depot/test-mercurial-import/file_text+d#2
213 213 edit //depot/test-mercurial-import/file_text+f#2
214 214 edit //depot/test-mercurial-import/file_text+k#2
215 215 edit //depot/test-mercurial-import/file_text+ko#2
216 216 edit //depot/test-mercurial-import/file_text+kx#2
217 217 edit //depot/test-mercurial-import/file_text+l#2
218 218 edit //depot/test-mercurial-import/file_text+m#2
219 219 edit //depot/test-mercurial-import/file_text+s#2
220 220 edit //depot/test-mercurial-import/file_text+s2#2
221 221 edit //depot/test-mercurial-import/file_text+w#2
222 222 edit //depot/test-mercurial-import/file_text+x#2
223 223 edit //depot/test-mercurial-import/file_ubinary#2
224 224 edit //depot/test-mercurial-import/file_uxbinary#2
225 225 edit //depot/test-mercurial-import/file_xbinary#2
226 226 edit //depot/test-mercurial-import/file_xltext#2
227 227 edit //depot/test-mercurial-import/file_xtempobj#2
228 228 edit //depot/test-mercurial-import/file_xtext#2
229 229 edit //depot/test-mercurial-import/target_symlink#2
230 230 edit //depot/test-mercurial-import/target_symlink+k#2
231 231 Change 2 submitted.
232 232 //depot/test-mercurial-import/crazy_symlink+k#1 - refreshing
233 233 //depot/test-mercurial-import/file_binary+k#2 - refreshing
234 234 //depot/test-mercurial-import/file_binary+kx#2 - refreshing
235 235 //depot/test-mercurial-import/file_ktext#2 - refreshing
236 236 //depot/test-mercurial-import/file_kxtext#2 - refreshing
237 237 //depot/test-mercurial-import/file_symlink+k#2 - refreshing
238 238 //depot/test-mercurial-import/file_text+k#2 - refreshing
239 239 //depot/test-mercurial-import/file_text+ko#2 - refreshing
240 240 //depot/test-mercurial-import/file_text+kx#2 - refreshing
241 241
242 242 check keywords in p4
243 243 $ grep -H Header file_*
244 244 file_binary:$Header$
245 245 file_binary:$Header$$Header$Header$
246 246 file_binary+k:$Header: //depot/test-mercurial-import/file_binary+k#2 $
247 247 file_binary+k:$Header: //depot/test-mercurial-import/file_binary+k#2 $$Header: //depot/test-mercurial-import/file_binary+k#2 $Header$
248 248 file_binary+kx:$Header: //depot/test-mercurial-import/file_binary+kx#2 $
249 249 file_binary+kx:$Header: //depot/test-mercurial-import/file_binary+kx#2 $$Header: //depot/test-mercurial-import/file_binary+kx#2 $Header$
250 250 file_binary+x:$Header$
251 251 file_binary+x:$Header$$Header$Header$
252 252 file_ctext:$Header$
253 253 file_ctext:$Header$$Header$Header$
254 254 file_cxtext:$Header$
255 255 file_cxtext:$Header$$Header$Header$
256 256 file_ktext:$Header: //depot/test-mercurial-import/file_ktext#2 $
257 257 file_ktext:$Header: //depot/test-mercurial-import/file_ktext#2 $$Header: //depot/test-mercurial-import/file_ktext#2 $Header$
258 258 file_kxtext:$Header: //depot/test-mercurial-import/file_kxtext#2 $
259 259 file_kxtext:$Header: //depot/test-mercurial-import/file_kxtext#2 $$Header: //depot/test-mercurial-import/file_kxtext#2 $Header$
260 260 file_ltext:$Header$
261 261 file_ltext:$Header$$Header$Header$
262 262 file_symlink:$Header$
263 263 file_symlink:$Header$$Header$Header$
264 264 file_symlink+k:$Header$
265 265 file_symlink+k:$Header$$Header$Header$
266 266 file_tempobj:$Header$
267 267 file_tempobj:$Header$$Header$Header$
268 268 file_text:$Header$
269 269 file_text:$Header$$Header$Header$
270 270 file_text+c:$Header$
271 271 file_text+c:$Header$$Header$Header$
272 272 file_text+d:$Header$
273 273 file_text+d:$Header$$Header$Header$
274 274 file_text+f:$Header$
275 275 file_text+f:$Header$$Header$Header$
276 276 file_text+k:$Header: //depot/test-mercurial-import/file_text+k#2 $
277 277 file_text+k:$Header: //depot/test-mercurial-import/file_text+k#2 $$Header: //depot/test-mercurial-import/file_text+k#2 $Header$
278 278 file_text+ko:$Header: //depot/test-mercurial-import/file_text+ko#2 $
279 279 file_text+ko:$Header: //depot/test-mercurial-import/file_text+ko#2 $$Header: //depot/test-mercurial-import/file_text+ko#2 $Header$
280 280 file_text+kx:$Header: //depot/test-mercurial-import/file_text+kx#2 $
281 281 file_text+kx:$Header: //depot/test-mercurial-import/file_text+kx#2 $$Header: //depot/test-mercurial-import/file_text+kx#2 $Header$
282 282 file_text+l:$Header$
283 283 file_text+l:$Header$$Header$Header$
284 284 file_text+m:$Header$
285 285 file_text+m:$Header$$Header$Header$
286 286 file_text+s:$Header$
287 287 file_text+s:$Header$$Header$Header$
288 288 file_text+s2:$Header$
289 289 file_text+s2:$Header$$Header$Header$
290 290 file_text+w:$Header$
291 291 file_text+w:$Header$$Header$Header$
292 292 file_text+x:$Header$
293 293 file_text+x:$Header$$Header$Header$
294 294 file_ubinary:$Header$
295 295 file_ubinary:$Header$$Header$Header$
296 296 file_uxbinary:$Header$
297 297 file_uxbinary:$Header$$Header$Header$
298 298 file_xbinary:$Header$
299 299 file_xbinary:$Header$$Header$Header$
300 300 file_xltext:$Header$
301 301 file_xltext:$Header$$Header$Header$
302 302 file_xtempobj:$Header$
303 303 file_xtempobj:$Header$$Header$Header$
304 304 file_xtext:$Header$
305 305 file_xtext:$Header$$Header$Header$
306 306
307 307 convert
308 308 $ hg convert -s p4 $DEPOTPATH dst
309 309 initializing destination dst repository
310 scanning source...
310 311 reading p4 views
311 312 collecting p4 changelists
312 313 1 initial
313 314 2 keywords
314 scanning source...
315 315 sorting...
316 316 converting...
317 317 1 initial
318 318 0 keywords
319 319 $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
320 320 rev=1 desc="keywords" tags="tip" files="crazy_symlink+k file_binary file_binary+k file_binary+kx file_binary+x file_ctext file_cxtext file_ktext file_kxtext file_ltext file_tempobj file_text file_text+c file_text+d file_text+f file_text+k file_text+ko file_text+kx file_text+l file_text+m file_text+s file_text+s2 file_text+w file_text+x file_ubinary file_uxbinary file_xbinary file_xltext file_xtempobj file_xtext target_symlink target_symlink+k"
321 321 rev=0 desc="initial" tags="" files="file_binary file_binary+k file_binary+kx file_binary+x file_ctext file_cxtext file_ktext file_kxtext file_ltext file_symlink file_symlink+k file_text file_text+c file_text+d file_text+f file_text+k file_text+ko file_text+kx file_text+l file_text+m file_text+s2 file_text+w file_text+x file_ubinary file_uxbinary file_xbinary file_xltext file_xtext target_symlink target_symlink+k"
322 322
323 323 revision 0
324 324 $ hg -R dst update 0
325 325 30 files updated, 0 files merged, 0 files removed, 0 files unresolved
326 326 $ head dst/file_* | cat -v
327 327 ==> dst/file_binary <==
328 328 this is binary
329 329 ==> dst/file_binary+k <==
330 330 this is binary+k
331 331 ==> dst/file_binary+kx <==
332 332 this is binary+kx
333 333 ==> dst/file_binary+x <==
334 334 this is binary+x
335 335 ==> dst/file_ctext <==
336 336 this is ctext
337 337
338 338 ==> dst/file_cxtext <==
339 339 this is cxtext
340 340
341 341 ==> dst/file_ktext <==
342 342 this is ktext
343 343
344 344 ==> dst/file_kxtext <==
345 345 this is kxtext
346 346
347 347 ==> dst/file_ltext <==
348 348 this is ltext
349 349
350 350 ==> dst/file_symlink <==
351 351 this is target symlink
352 352
353 353 ==> dst/file_symlink+k <==
354 354 this is target symlink+k
355 355
356 356 ==> dst/file_text <==
357 357 this is text
358 358
359 359 ==> dst/file_text+c <==
360 360 this is text+C
361 361
362 362 ==> dst/file_text+d <==
363 363 this is text+D
364 364
365 365 ==> dst/file_text+f <==
366 366 this is text+F
367 367
368 368 ==> dst/file_text+k <==
369 369 this is text+k
370 370
371 371 ==> dst/file_text+ko <==
372 372 this is text+ko
373 373
374 374 ==> dst/file_text+kx <==
375 375 this is text+kx
376 376
377 377 ==> dst/file_text+l <==
378 378 this is text+l
379 379
380 380 ==> dst/file_text+m <==
381 381 this is text+m
382 382
383 383 ==> dst/file_text+s2 <==
384 384 this is text+S2
385 385
386 386 ==> dst/file_text+w <==
387 387 this is text+w
388 388
389 389 ==> dst/file_text+x <==
390 390 this is text+x
391 391
392 392 ==> dst/file_ubinary <==
393 393 this is ubinary
394 394
395 395 ==> dst/file_uxbinary <==
396 396 this is uxbinary
397 397
398 398 ==> dst/file_xbinary <==
399 399 this is xbinary
400 400
401 401 ==> dst/file_xltext <==
402 402 this is xltext
403 403
404 404 ==> dst/file_xtext <==
405 405 this is xtext
406 406
407 407 revision 1
408 408 $ hg -R dst update 1
409 409 32 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 410 $ head dst/file_* | cat -v
411 411 ==> dst/file_binary <==
412 412 this is binary$Id$
413 413 $Header$
414 414 $Date$
415 415 $DateTime$
416 416 $Change$
417 417 $File$
418 418 $Revision$
419 419 $Header$$Header$Header$
420 420
421 421 ==> dst/file_binary+k <==
422 422 this is binary+k$Id$
423 423 $Header$
424 424 $Date$
425 425 $DateTime$
426 426 $Change$
427 427 $File$
428 428 $Revision$
429 429 $Header$$Header$Header$
430 430
431 431 ==> dst/file_binary+kx <==
432 432 this is binary+kx$Id$
433 433 $Header$
434 434 $Date$
435 435 $DateTime$
436 436 $Change$
437 437 $File$
438 438 $Revision$
439 439 $Header$$Header$Header$
440 440
441 441 ==> dst/file_binary+x <==
442 442 this is binary+x$Id$
443 443 $Header$
444 444 $Date$
445 445 $DateTime$
446 446 $Change$
447 447 $File$
448 448 $Revision$
449 449 $Header$$Header$Header$
450 450
451 451 ==> dst/file_ctext <==
452 452 this is ctext
453 453 $Id$
454 454 $Header$
455 455 $Date$
456 456 $DateTime$
457 457 $Change$
458 458 $File$
459 459 $Revision$
460 460 $Header$$Header$Header$
461 461
462 462 ==> dst/file_cxtext <==
463 463 this is cxtext
464 464 $Id$
465 465 $Header$
466 466 $Date$
467 467 $DateTime$
468 468 $Change$
469 469 $File$
470 470 $Revision$
471 471 $Header$$Header$Header$
472 472
473 473 ==> dst/file_ktext <==
474 474 this is ktext
475 475 $Id$
476 476 $Header$
477 477 $Date$
478 478 $DateTime$
479 479 $Change$
480 480 $File$
481 481 $Revision$
482 482 $Header$$Header$Header$
483 483
484 484 ==> dst/file_kxtext <==
485 485 this is kxtext
486 486 $Id$
487 487 $Header$
488 488 $Date$
489 489 $DateTime$
490 490 $Change$
491 491 $File$
492 492 $Revision$
493 493 $Header$$Header$Header$
494 494
495 495 ==> dst/file_ltext <==
496 496 this is ltext
497 497 $Id$
498 498 $Header$
499 499 $Date$
500 500 $DateTime$
501 501 $Change$
502 502 $File$
503 503 $Revision$
504 504 $Header$$Header$Header$
505 505
506 506 ==> dst/file_symlink <==
507 507 this is target symlink
508 508 $Id$
509 509 $Header$
510 510 $Date$
511 511 $DateTime$
512 512 $Change$
513 513 $File$
514 514 $Revision$
515 515 $Header$$Header$Header$
516 516
517 517 ==> dst/file_symlink+k <==
518 518 this is target symlink+k
519 519 $Id$
520 520 $Header$
521 521 $Date$
522 522 $DateTime$
523 523 $Change$
524 524 $File$
525 525 $Revision$
526 526 $Header$$Header$Header$
527 527
528 528 ==> dst/file_tempobj <==
529 529 this is tempobj
530 530 $Id$
531 531 $Header$
532 532 $Date$
533 533 $DateTime$
534 534 $Change$
535 535 $File$
536 536 $Revision$
537 537 $Header$$Header$Header$
538 538
539 539 ==> dst/file_text <==
540 540 this is text
541 541 $Id$
542 542 $Header$
543 543 $Date$
544 544 $DateTime$
545 545 $Change$
546 546 $File$
547 547 $Revision$
548 548 $Header$$Header$Header$
549 549
550 550 ==> dst/file_text+c <==
551 551 this is text+C
552 552 $Id$
553 553 $Header$
554 554 $Date$
555 555 $DateTime$
556 556 $Change$
557 557 $File$
558 558 $Revision$
559 559 $Header$$Header$Header$
560 560
561 561 ==> dst/file_text+d <==
562 562 this is text+D
563 563 $Id$
564 564 $Header$
565 565 $Date$
566 566 $DateTime$
567 567 $Change$
568 568 $File$
569 569 $Revision$
570 570 $Header$$Header$Header$
571 571
572 572 ==> dst/file_text+f <==
573 573 this is text+F
574 574 $Id$
575 575 $Header$
576 576 $Date$
577 577 $DateTime$
578 578 $Change$
579 579 $File$
580 580 $Revision$
581 581 $Header$$Header$Header$
582 582
583 583 ==> dst/file_text+k <==
584 584 this is text+k
585 585 $Id$
586 586 $Header$
587 587 $Date$
588 588 $DateTime$
589 589 $Change$
590 590 $File$
591 591 $Revision$
592 592 $Header$$Header$Header$
593 593
594 594 ==> dst/file_text+ko <==
595 595 this is text+ko
596 596 $Id$
597 597 $Header$
598 598 $Date$
599 599 $DateTime$
600 600 $Change$
601 601 $File$
602 602 $Revision$
603 603 $Header$$Header$Header$
604 604
605 605 ==> dst/file_text+kx <==
606 606 this is text+kx
607 607 $Id$
608 608 $Header$
609 609 $Date$
610 610 $DateTime$
611 611 $Change$
612 612 $File$
613 613 $Revision$
614 614 $Header$$Header$Header$
615 615
616 616 ==> dst/file_text+l <==
617 617 this is text+l
618 618 $Id$
619 619 $Header$
620 620 $Date$
621 621 $DateTime$
622 622 $Change$
623 623 $File$
624 624 $Revision$
625 625 $Header$$Header$Header$
626 626
627 627 ==> dst/file_text+m <==
628 628 this is text+m
629 629 $Id$
630 630 $Header$
631 631 $Date$
632 632 $DateTime$
633 633 $Change$
634 634 $File$
635 635 $Revision$
636 636 $Header$$Header$Header$
637 637
638 638 ==> dst/file_text+s <==
639 639 this is text+S
640 640 $Id$
641 641 $Header$
642 642 $Date$
643 643 $DateTime$
644 644 $Change$
645 645 $File$
646 646 $Revision$
647 647 $Header$$Header$Header$
648 648
649 649 ==> dst/file_text+s2 <==
650 650 this is text+S2
651 651 $Id$
652 652 $Header$
653 653 $Date$
654 654 $DateTime$
655 655 $Change$
656 656 $File$
657 657 $Revision$
658 658 $Header$$Header$Header$
659 659
660 660 ==> dst/file_text+w <==
661 661 this is text+w
662 662 $Id$
663 663 $Header$
664 664 $Date$
665 665 $DateTime$
666 666 $Change$
667 667 $File$
668 668 $Revision$
669 669 $Header$$Header$Header$
670 670
671 671 ==> dst/file_text+x <==
672 672 this is text+x
673 673 $Id$
674 674 $Header$
675 675 $Date$
676 676 $DateTime$
677 677 $Change$
678 678 $File$
679 679 $Revision$
680 680 $Header$$Header$Header$
681 681
682 682 ==> dst/file_ubinary <==
683 683 this is ubinary
684 684 $Id$
685 685 $Header$
686 686 $Date$
687 687 $DateTime$
688 688 $Change$
689 689 $File$
690 690 $Revision$
691 691 $Header$$Header$Header$
692 692
693 693 ==> dst/file_uxbinary <==
694 694 this is uxbinary
695 695 $Id$
696 696 $Header$
697 697 $Date$
698 698 $DateTime$
699 699 $Change$
700 700 $File$
701 701 $Revision$
702 702 $Header$$Header$Header$
703 703
704 704 ==> dst/file_xbinary <==
705 705 this is xbinary
706 706 $Id$
707 707 $Header$
708 708 $Date$
709 709 $DateTime$
710 710 $Change$
711 711 $File$
712 712 $Revision$
713 713 $Header$$Header$Header$
714 714
715 715 ==> dst/file_xltext <==
716 716 this is xltext
717 717 $Id$
718 718 $Header$
719 719 $Date$
720 720 $DateTime$
721 721 $Change$
722 722 $File$
723 723 $Revision$
724 724 $Header$$Header$Header$
725 725
726 726 ==> dst/file_xtempobj <==
727 727 this is xtempobj
728 728 $Id$
729 729 $Header$
730 730 $Date$
731 731 $DateTime$
732 732 $Change$
733 733 $File$
734 734 $Revision$
735 735 $Header$$Header$Header$
736 736
737 737 ==> dst/file_xtext <==
738 738 this is xtext
739 739 $Id$
740 740 $Header$
741 741 $Date$
742 742 $DateTime$
743 743 $Change$
744 744 $File$
745 745 $Revision$
746 746 $Header$$Header$Header$
747 747
748 748 crazy_symlink
749 749 $ readlink crazy_symlink+k
750 750 target_$Header: //depot/test-mercurial-import/crazy_symlink+k#1 $
751 751 $ readlink dst/crazy_symlink+k
752 752 target_$Header$
753 753
754 754 exit trap:
755 755 stopping the p4 server
@@ -1,152 +1,145
1 1 #require p4
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "convert = " >> $HGRCPATH
5 5
6 6 create p4 depot
7 7 $ P4ROOT=`pwd`/depot; export P4ROOT
8 8 $ P4AUDIT=$P4ROOT/audit; export P4AUDIT
9 9 $ P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
10 10 $ P4LOG=$P4ROOT/log; export P4LOG
11 11 $ P4PORT=localhost:$HGPORT; export P4PORT
12 12 $ P4DEBUG=1; export P4DEBUG
13 13
14 14 start the p4 server
15 15 $ [ ! -d $P4ROOT ] && mkdir $P4ROOT
16 16 $ p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
17 17 $ echo $! >> $DAEMON_PIDS
18 18 $ trap "echo stopping the p4 server ; p4 admin stop" EXIT
19 19
20 20 $ # wait for the server to initialize
21 21 $ while ! p4 ; do
22 22 > sleep 1
23 23 > done >/dev/null 2>/dev/null
24 24
25 25 create a client spec
26 26 $ P4CLIENT=hg-p4-import; export P4CLIENT
27 27 $ DEPOTPATH=//depot/test-mercurial-import/...
28 28 $ p4 client -o | sed '/^View:/,$ d' >p4client
29 29 $ echo View: >>p4client
30 30 $ echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
31 31 $ p4 client -i <p4client
32 32 Client hg-p4-import saved.
33 33
34 34 populate the depot
35 35 $ echo a > a
36 36 $ mkdir b
37 37 $ echo c > b/c
38 38 $ p4 add a b/c
39 39 //depot/test-mercurial-import/a#1 - opened for add
40 40 //depot/test-mercurial-import/b/c#1 - opened for add
41 41 $ p4 submit -d initial
42 42 Submitting change 1.
43 43 Locking 2 files ...
44 44 add //depot/test-mercurial-import/a#1
45 45 add //depot/test-mercurial-import/b/c#1
46 46 Change 1 submitted.
47 47
48 48 change some files
49 49 $ p4 edit a
50 50 //depot/test-mercurial-import/a#1 - opened for edit
51 51 $ echo aa >> a
52 52 $ p4 submit -d "change a"
53 53 Submitting change 2.
54 54 Locking 1 files ...
55 55 edit //depot/test-mercurial-import/a#2
56 56 Change 2 submitted.
57 57
58 58 $ p4 edit b/c
59 59 //depot/test-mercurial-import/b/c#1 - opened for edit
60 60 $ echo cc >> b/c
61 61 $ p4 submit -d "change b/c"
62 62 Submitting change 3.
63 63 Locking 1 files ...
64 64 edit //depot/test-mercurial-import/b/c#2
65 65 Change 3 submitted.
66 66
67 67 convert
68 68 $ hg convert -s p4 $DEPOTPATH dst
69 69 initializing destination dst repository
70 scanning source...
70 71 reading p4 views
71 72 collecting p4 changelists
72 73 1 initial
73 74 2 change a
74 75 3 change b/c
75 scanning source...
76 76 sorting...
77 77 converting...
78 78 2 initial
79 79 1 change a
80 80 0 change b/c
81 81 $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
82 82 rev=2 desc="change b/c" tags="tip" files="b/c"
83 83 rev=1 desc="change a" tags="" files="a"
84 84 rev=0 desc="initial" tags="" files="a b/c"
85 85
86 86 change some files
87 87 $ p4 edit a b/c
88 88 //depot/test-mercurial-import/a#2 - opened for edit
89 89 //depot/test-mercurial-import/b/c#2 - opened for edit
90 90 $ echo aaa >> a
91 91 $ echo ccc >> b/c
92 92 $ p4 submit -d "change a b/c"
93 93 Submitting change 4.
94 94 Locking 2 files ...
95 95 edit //depot/test-mercurial-import/a#3
96 96 edit //depot/test-mercurial-import/b/c#3
97 97 Change 4 submitted.
98 98
99 99 convert again
100 100 $ hg convert -s p4 $DEPOTPATH dst
101 scanning source...
101 102 reading p4 views
102 103 collecting p4 changelists
103 1 initial
104 2 change a
105 3 change b/c
106 104 4 change a b/c
107 scanning source...
108 105 sorting...
109 106 converting...
110 107 0 change a b/c
111 108 $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
112 109 rev=3 desc="change a b/c" tags="tip" files="a b/c"
113 110 rev=2 desc="change b/c" tags="" files="b/c"
114 111 rev=1 desc="change a" tags="" files="a"
115 112 rev=0 desc="initial" tags="" files="a b/c"
116 113
117 114 interesting names
118 115 $ echo dddd > "d d"
119 116 $ mkdir " e"
120 117 $ echo fff >" e/ f"
121 118 $ p4 add "d d" " e/ f"
122 119 //depot/test-mercurial-import/d d#1 - opened for add
123 120 //depot/test-mercurial-import/ e/ f#1 - opened for add
124 121 $ p4 submit -d "add d e f"
125 122 Submitting change 5.
126 123 Locking 2 files ...
127 124 add //depot/test-mercurial-import/ e/ f#1
128 125 add //depot/test-mercurial-import/d d#1
129 126 Change 5 submitted.
130 127
131 128 convert again
132 129 $ hg convert -s p4 $DEPOTPATH dst
130 scanning source...
133 131 reading p4 views
134 132 collecting p4 changelists
135 1 initial
136 2 change a
137 3 change b/c
138 4 change a b/c
139 133 5 add d e f
140 scanning source...
141 134 sorting...
142 135 converting...
143 136 0 add d e f
144 137 $ hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
145 138 rev=4 desc="add d e f" tags="tip" files=" e/ f d d"
146 139 rev=3 desc="change a b/c" tags="" files="a b/c"
147 140 rev=2 desc="change b/c" tags="" files="b/c"
148 141 rev=1 desc="change a" tags="" files="a"
149 142 rev=0 desc="initial" tags="" files="a b/c"
150 143
151 144 exit trap:
152 145 stopping the p4 server
General Comments 0
You need to be logged in to leave comments. Login now