##// END OF EJS Templates
archive: look for first visible revision to build repo identity (issue4591)...
Yuya Nishihara -
r24681:33ab99a6 default
parent child Browse files
Show More
@@ -1,316 +1,322 b''
1 1 # archival.py - revision archival for mercurial
2 2 #
3 3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
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
8 8 from i18n import _
9 9 import match as matchmod
10 10 import cmdutil
11 11 import scmutil, util, encoding
12 12 import cStringIO, os, tarfile, time, zipfile
13 13 import zlib, gzip
14 14 import struct
15 15 import error
16 16
17 17 # from unzip source code:
18 18 _UNX_IFREG = 0x8000
19 19 _UNX_IFLNK = 0xa000
20 20
21 21 def tidyprefix(dest, kind, prefix):
22 22 '''choose prefix to use for names in archive. make sure prefix is
23 23 safe for consumers.'''
24 24
25 25 if prefix:
26 26 prefix = util.normpath(prefix)
27 27 else:
28 28 if not isinstance(dest, str):
29 29 raise ValueError('dest must be string if no prefix')
30 30 prefix = os.path.basename(dest)
31 31 lower = prefix.lower()
32 32 for sfx in exts.get(kind, []):
33 33 if lower.endswith(sfx):
34 34 prefix = prefix[:-len(sfx)]
35 35 break
36 36 lpfx = os.path.normpath(util.localpath(prefix))
37 37 prefix = util.pconvert(lpfx)
38 38 if not prefix.endswith('/'):
39 39 prefix += '/'
40 40 if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix:
41 41 raise util.Abort(_('archive prefix contains illegal components'))
42 42 return prefix
43 43
44 44 exts = {
45 45 'tar': ['.tar'],
46 46 'tbz2': ['.tbz2', '.tar.bz2'],
47 47 'tgz': ['.tgz', '.tar.gz'],
48 48 'zip': ['.zip'],
49 49 }
50 50
51 51 def guesskind(dest):
52 52 for kind, extensions in exts.iteritems():
53 53 if util.any(dest.endswith(ext) for ext in extensions):
54 54 return kind
55 55 return None
56 56
57 def _rootctx(repo):
58 # repo[0] may be hidden
59 for rev in repo:
60 return repo[rev]
61 return repo['null']
62
57 63 def buildmetadata(ctx):
58 64 '''build content of .hg_archival.txt'''
59 65 repo = ctx.repo()
60 66 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
61 repo[0].hex(), ctx.hex(), encoding.fromlocal(ctx.branch()))
67 _rootctx(repo).hex(), ctx.hex(), encoding.fromlocal(ctx.branch()))
62 68
63 69 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
64 70 if repo.tagtype(t) == 'global')
65 71 if not tags:
66 72 repo.ui.pushbuffer()
67 73 opts = {'template': '{latesttag}\n{latesttagdistance}',
68 74 'style': '', 'patch': None, 'git': None}
69 75 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
70 76 ltags, dist = repo.ui.popbuffer().split('\n')
71 77 ltags = ltags.split(':')
72 78 changessince = len(repo.revs('only(.,%s)', ltags[0]))
73 79 tags = ''.join('latesttag: %s\n' % t for t in ltags)
74 80 tags += 'latesttagdistance: %s\n' % dist
75 81 tags += 'changessincelatesttag: %s\n' % changessince
76 82
77 83 return base + tags
78 84
79 85 class tarit(object):
80 86 '''write archive to tar file or stream. can write uncompressed,
81 87 or compress with gzip or bzip2.'''
82 88
83 89 class GzipFileWithTime(gzip.GzipFile):
84 90
85 91 def __init__(self, *args, **kw):
86 92 timestamp = None
87 93 if 'timestamp' in kw:
88 94 timestamp = kw.pop('timestamp')
89 95 if timestamp is None:
90 96 self.timestamp = time.time()
91 97 else:
92 98 self.timestamp = timestamp
93 99 gzip.GzipFile.__init__(self, *args, **kw)
94 100
95 101 def _write_gzip_header(self):
96 102 self.fileobj.write('\037\213') # magic header
97 103 self.fileobj.write('\010') # compression method
98 104 # Python 2.6 introduced self.name and deprecated self.filename
99 105 try:
100 106 fname = self.name
101 107 except AttributeError:
102 108 fname = self.filename
103 109 if fname and fname.endswith('.gz'):
104 110 fname = fname[:-3]
105 111 flags = 0
106 112 if fname:
107 113 flags = gzip.FNAME
108 114 self.fileobj.write(chr(flags))
109 115 gzip.write32u(self.fileobj, long(self.timestamp))
110 116 self.fileobj.write('\002')
111 117 self.fileobj.write('\377')
112 118 if fname:
113 119 self.fileobj.write(fname + '\000')
114 120
115 121 def __init__(self, dest, mtime, kind=''):
116 122 self.mtime = mtime
117 123 self.fileobj = None
118 124
119 125 def taropen(name, mode, fileobj=None):
120 126 if kind == 'gz':
121 127 mode = mode[0]
122 128 if not fileobj:
123 129 fileobj = open(name, mode + 'b')
124 130 gzfileobj = self.GzipFileWithTime(name, mode + 'b',
125 131 zlib.Z_BEST_COMPRESSION,
126 132 fileobj, timestamp=mtime)
127 133 self.fileobj = gzfileobj
128 134 return tarfile.TarFile.taropen(name, mode, gzfileobj)
129 135 else:
130 136 return tarfile.open(name, mode + kind, fileobj)
131 137
132 138 if isinstance(dest, str):
133 139 self.z = taropen(dest, mode='w:')
134 140 else:
135 141 # Python 2.5-2.5.1 have a regression that requires a name arg
136 142 self.z = taropen(name='', mode='w|', fileobj=dest)
137 143
138 144 def addfile(self, name, mode, islink, data):
139 145 i = tarfile.TarInfo(name)
140 146 i.mtime = self.mtime
141 147 i.size = len(data)
142 148 if islink:
143 149 i.type = tarfile.SYMTYPE
144 150 i.mode = 0777
145 151 i.linkname = data
146 152 data = None
147 153 i.size = 0
148 154 else:
149 155 i.mode = mode
150 156 data = cStringIO.StringIO(data)
151 157 self.z.addfile(i, data)
152 158
153 159 def done(self):
154 160 self.z.close()
155 161 if self.fileobj:
156 162 self.fileobj.close()
157 163
158 164 class tellable(object):
159 165 '''provide tell method for zipfile.ZipFile when writing to http
160 166 response file object.'''
161 167
162 168 def __init__(self, fp):
163 169 self.fp = fp
164 170 self.offset = 0
165 171
166 172 def __getattr__(self, key):
167 173 return getattr(self.fp, key)
168 174
169 175 def write(self, s):
170 176 self.fp.write(s)
171 177 self.offset += len(s)
172 178
173 179 def tell(self):
174 180 return self.offset
175 181
176 182 class zipit(object):
177 183 '''write archive to zip file or stream. can write uncompressed,
178 184 or compressed with deflate.'''
179 185
180 186 def __init__(self, dest, mtime, compress=True):
181 187 if not isinstance(dest, str):
182 188 try:
183 189 dest.tell()
184 190 except (AttributeError, IOError):
185 191 dest = tellable(dest)
186 192 self.z = zipfile.ZipFile(dest, 'w',
187 193 compress and zipfile.ZIP_DEFLATED or
188 194 zipfile.ZIP_STORED)
189 195
190 196 # Python's zipfile module emits deprecation warnings if we try
191 197 # to store files with a date before 1980.
192 198 epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0))
193 199 if mtime < epoch:
194 200 mtime = epoch
195 201
196 202 self.mtime = mtime
197 203 self.date_time = time.gmtime(mtime)[:6]
198 204
199 205 def addfile(self, name, mode, islink, data):
200 206 i = zipfile.ZipInfo(name, self.date_time)
201 207 i.compress_type = self.z.compression
202 208 # unzip will not honor unix file modes unless file creator is
203 209 # set to unix (id 3).
204 210 i.create_system = 3
205 211 ftype = _UNX_IFREG
206 212 if islink:
207 213 mode = 0777
208 214 ftype = _UNX_IFLNK
209 215 i.external_attr = (mode | ftype) << 16L
210 216 # add "extended-timestamp" extra block, because zip archives
211 217 # without this will be extracted with unexpected timestamp,
212 218 # if TZ is not configured as GMT
213 219 i.extra += struct.pack('<hhBl',
214 220 0x5455, # block type: "extended-timestamp"
215 221 1 + 4, # size of this block
216 222 1, # "modification time is present"
217 223 int(self.mtime)) # last modification (UTC)
218 224 self.z.writestr(i, data)
219 225
220 226 def done(self):
221 227 self.z.close()
222 228
223 229 class fileit(object):
224 230 '''write archive as files in directory.'''
225 231
226 232 def __init__(self, name, mtime):
227 233 self.basedir = name
228 234 self.opener = scmutil.opener(self.basedir)
229 235
230 236 def addfile(self, name, mode, islink, data):
231 237 if islink:
232 238 self.opener.symlink(data, name)
233 239 return
234 240 f = self.opener(name, "w", atomictemp=True)
235 241 f.write(data)
236 242 f.close()
237 243 destfile = os.path.join(self.basedir, name)
238 244 os.chmod(destfile, mode)
239 245
240 246 def done(self):
241 247 pass
242 248
243 249 archivers = {
244 250 'files': fileit,
245 251 'tar': tarit,
246 252 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'),
247 253 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'),
248 254 'uzip': lambda name, mtime: zipit(name, mtime, False),
249 255 'zip': zipit,
250 256 }
251 257
252 258 def archive(repo, dest, node, kind, decode=True, matchfn=None,
253 259 prefix='', mtime=None, subrepos=False):
254 260 '''create archive of repo as it was at node.
255 261
256 262 dest can be name of directory, name of archive file, or file
257 263 object to write archive to.
258 264
259 265 kind is type of archive to create.
260 266
261 267 decode tells whether to put files through decode filters from
262 268 hgrc.
263 269
264 270 matchfn is function to filter names of files to write to archive.
265 271
266 272 prefix is name of path to put before every archive member.'''
267 273
268 274 if kind == 'files':
269 275 if prefix:
270 276 raise util.Abort(_('cannot give prefix when archiving to files'))
271 277 else:
272 278 prefix = tidyprefix(dest, kind, prefix)
273 279
274 280 def write(name, mode, islink, getdata):
275 281 data = getdata()
276 282 if decode:
277 283 data = repo.wwritedata(name, data)
278 284 archiver.addfile(prefix + name, mode, islink, data)
279 285
280 286 if kind not in archivers:
281 287 raise util.Abort(_("unknown archive type '%s'") % kind)
282 288
283 289 ctx = repo[node]
284 290 archiver = archivers[kind](dest, mtime or ctx.date()[0])
285 291
286 292 if repo.ui.configbool("ui", "archivemeta", True):
287 293 name = '.hg_archival.txt'
288 294 if not matchfn or matchfn(name):
289 295 write(name, 0644, False, lambda: buildmetadata(ctx))
290 296
291 297 if matchfn:
292 298 files = [f for f in ctx.manifest().keys() if matchfn(f)]
293 299 else:
294 300 files = ctx.manifest().keys()
295 301 total = len(files)
296 302 if total:
297 303 files.sort()
298 304 repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total)
299 305 for i, f in enumerate(files):
300 306 ff = ctx.flags(f)
301 307 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)
302 308 repo.ui.progress(_('archiving'), i + 1, item=f,
303 309 unit=_('files'), total=total)
304 310 repo.ui.progress(_('archiving'), None)
305 311
306 312 if subrepos:
307 313 for subpath in sorted(ctx.substate):
308 314 sub = ctx.sub(subpath)
309 315 submatch = matchmod.narrowmatcher(subpath, matchfn)
310 316 total += sub.archive(archiver, prefix, submatch)
311 317
312 318 if total == 0:
313 319 raise error.Abort(_('no files match the archive pattern'))
314 320
315 321 archiver.done()
316 322 return total
@@ -1,797 +1,821 b''
1 1 $ cat >> $HGRCPATH << EOF
2 2 > [phases]
3 3 > # public changeset are not obsolete
4 4 > publish=false
5 5 > [ui]
6 6 > logtemplate="{rev}:{node|short} ({phase}) [{tags} {bookmarks}] {desc|firstline}\n"
7 7 > EOF
8 8 $ mkcommit() {
9 9 > echo "$1" > "$1"
10 10 > hg add "$1"
11 11 > hg ci -m "add $1"
12 12 > }
13 13 $ getid() {
14 14 > hg log -T "{node}\n" --hidden -r "desc('$1')"
15 15 > }
16 16
17 17 $ cat > debugkeys.py <<EOF
18 18 > def reposetup(ui, repo):
19 19 > class debugkeysrepo(repo.__class__):
20 20 > def listkeys(self, namespace):
21 21 > ui.write('listkeys %s\n' % (namespace,))
22 22 > return super(debugkeysrepo, self).listkeys(namespace)
23 23 >
24 24 > if repo.local():
25 25 > repo.__class__ = debugkeysrepo
26 26 > EOF
27 27
28 28 $ hg init tmpa
29 29 $ cd tmpa
30 30 $ mkcommit kill_me
31 31
32 32 Checking that the feature is properly disabled
33 33
34 34 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
35 35 abort: creating obsolete markers is not enabled on this repo
36 36 [255]
37 37
38 38 Enabling it
39 39
40 40 $ cat >> $HGRCPATH << EOF
41 41 > [experimental]
42 42 > evolution=createmarkers,exchange
43 43 > EOF
44 44
45 45 Killing a single changeset without replacement
46 46
47 47 $ hg debugobsolete 0
48 48 abort: changeset references must be full hexadecimal node identifiers
49 49 [255]
50 50 $ hg debugobsolete '00'
51 51 abort: changeset references must be full hexadecimal node identifiers
52 52 [255]
53 53 $ hg debugobsolete -d '0 0' `getid kill_me` -u babar
54 54 $ hg debugobsolete
55 55 97b7c2d76b1845ed3eb988cd612611e72406cef0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'babar'}
56 56
57 57 (test that mercurial is not confused)
58 58
59 59 $ hg up null --quiet # having 0 as parent prevents it to be hidden
60 60 $ hg tip
61 61 -1:000000000000 (public) [tip ]
62 62 $ hg up --hidden tip --quiet
63 63
64 64 Killing a single changeset with itself should fail
65 65 (simple local safeguard)
66 66
67 67 $ hg debugobsolete `getid kill_me` `getid kill_me`
68 68 abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0
69 69 [255]
70 70
71 71 $ cd ..
72 72
73 73 Killing a single changeset with replacement
74 74 (and testing the format option)
75 75
76 76 $ hg init tmpb
77 77 $ cd tmpb
78 78 $ mkcommit a
79 79 $ mkcommit b
80 80 $ mkcommit original_c
81 81 $ hg up "desc('b')"
82 82 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
83 83 $ mkcommit new_c
84 84 created new head
85 85 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
86 86 $ hg debugobsolete --config format.obsstore-version=0 --flag 12 `getid original_c` `getid new_c` -d '121 120'
87 87 $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
88 88 2:245bde4270cd add original_c
89 89 $ hg debugrevlog -cd
90 90 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
91 91 0 -1 -1 0 59 0 0 0 0 58 58 0 1 0
92 92 1 0 -1 59 118 59 59 0 0 58 116 0 1 0
93 93 2 1 -1 118 193 118 118 59 0 76 192 0 1 0
94 94 3 1 -1 193 260 193 193 59 0 66 258 0 2 0
95 95 $ hg debugobsolete
96 96 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
97 97
98 98 (check for version number of the obsstore)
99 99
100 100 $ dd bs=1 count=1 if=.hg/store/obsstore 2>/dev/null
101 101 \x00 (no-eol) (esc)
102 102
103 103 do it again (it read the obsstore before adding new changeset)
104 104
105 105 $ hg up '.^'
106 106 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 107 $ mkcommit new_2_c
108 108 created new head
109 109 $ hg debugobsolete -d '1337 0' `getid new_c` `getid new_2_c`
110 110 $ hg debugobsolete
111 111 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
112 112 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
113 113
114 114 Register two markers with a missing node
115 115
116 116 $ hg up '.^'
117 117 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
118 118 $ mkcommit new_3_c
119 119 created new head
120 120 $ hg debugobsolete -d '1338 0' `getid new_2_c` 1337133713371337133713371337133713371337
121 121 $ hg debugobsolete -d '1339 0' 1337133713371337133713371337133713371337 `getid new_3_c`
122 122 $ hg debugobsolete
123 123 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
124 124 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
125 125 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
126 126 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
127 127
128 128 Refuse pathological nullid successors
129 129 $ hg debugobsolete -d '9001 0' 1337133713371337133713371337133713371337 0000000000000000000000000000000000000000
130 130 transaction abort!
131 131 rollback completed
132 132 abort: bad obsolescence marker detected: invalid successors nullid
133 133 [255]
134 134
135 135 Check that graphlog detect that a changeset is obsolete:
136 136
137 137 $ hg log -G
138 138 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
139 139 |
140 140 o 1:7c3bad9141dc (draft) [ ] add b
141 141 |
142 142 o 0:1f0dee641bb7 (draft) [ ] add a
143 143
144 144
145 145 check that heads does not report them
146 146
147 147 $ hg heads
148 148 5:5601fb93a350 (draft) [tip ] add new_3_c
149 149 $ hg heads --hidden
150 150 5:5601fb93a350 (draft) [tip ] add new_3_c
151 151 4:ca819180edb9 (draft) [ ] add new_2_c
152 152 3:cdbce2fbb163 (draft) [ ] add new_c
153 153 2:245bde4270cd (draft) [ ] add original_c
154 154
155 155
156 156 check that summary does not report them
157 157
158 158 $ hg init ../sink
159 159 $ echo '[paths]' >> .hg/hgrc
160 160 $ echo 'default=../sink' >> .hg/hgrc
161 161 $ hg summary --remote
162 162 parent: 5:5601fb93a350 tip
163 163 add new_3_c
164 164 branch: default
165 165 commit: (clean)
166 166 update: (current)
167 167 remote: 3 outgoing
168 168
169 169 $ hg summary --remote --hidden
170 170 parent: 5:5601fb93a350 tip
171 171 add new_3_c
172 172 branch: default
173 173 commit: (clean)
174 174 update: 3 new changesets, 4 branch heads (merge)
175 175 remote: 3 outgoing
176 176
177 177 check that various commands work well with filtering
178 178
179 179 $ hg tip
180 180 5:5601fb93a350 (draft) [tip ] add new_3_c
181 181 $ hg log -r 6
182 182 abort: unknown revision '6'!
183 183 [255]
184 184 $ hg log -r 4
185 185 abort: hidden revision '4'!
186 186 (use --hidden to access hidden revisions)
187 187 [255]
188 188 $ hg debugrevspec 'rev(6)'
189 189 $ hg debugrevspec 'rev(4)'
190 190 $ hg debugrevspec 'null'
191 191 -1
192 192
193 193 Check that public changeset are not accounted as obsolete:
194 194
195 195 $ hg --hidden phase --public 2
196 196 $ hg log -G
197 197 @ 5:5601fb93a350 (draft) [tip ] add new_3_c
198 198 |
199 199 | o 2:245bde4270cd (public) [ ] add original_c
200 200 |/
201 201 o 1:7c3bad9141dc (public) [ ] add b
202 202 |
203 203 o 0:1f0dee641bb7 (public) [ ] add a
204 204
205 205
206 206 And that bumped changeset are detected
207 207 --------------------------------------
208 208
209 209 If we didn't filtered obsolete changesets out, 3 and 4 would show up too. Also
210 210 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
211 211 the public changeset
212 212
213 213 $ hg log --hidden -r 'bumped()'
214 214 5:5601fb93a350 (draft) [tip ] add new_3_c
215 215
216 216 And that we can't push bumped changeset
217 217
218 218 $ hg push ../tmpa -r 0 --force #(make repo related)
219 219 pushing to ../tmpa
220 220 searching for changes
221 221 warning: repository is unrelated
222 222 adding changesets
223 223 adding manifests
224 224 adding file changes
225 225 added 1 changesets with 1 changes to 1 files (+1 heads)
226 226 $ hg push ../tmpa
227 227 pushing to ../tmpa
228 228 searching for changes
229 229 abort: push includes bumped changeset: 5601fb93a350!
230 230 [255]
231 231
232 232 Fixing "bumped" situation
233 233 We need to create a clone of 5 and add a special marker with a flag
234 234
235 235 $ hg up '5^'
236 236 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
237 237 $ hg revert -ar 5
238 238 adding new_3_c
239 239 $ hg ci -m 'add n3w_3_c'
240 240 created new head
241 241 $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
242 242 $ hg log -r 'bumped()'
243 243 $ hg log -G
244 244 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
245 245 |
246 246 | o 2:245bde4270cd (public) [ ] add original_c
247 247 |/
248 248 o 1:7c3bad9141dc (public) [ ] add b
249 249 |
250 250 o 0:1f0dee641bb7 (public) [ ] add a
251 251
252 252
253 $ cd ..
254
255 Revision 0 is hidden
256 --------------------
257
258 $ hg init rev0hidden
259 $ cd rev0hidden
260
261 $ mkcommit kill0
262 $ hg up -q null
263 $ hg debugobsolete `getid kill0`
264 $ mkcommit a
265 $ mkcommit b
266
267 Should pick the first visible revision as "repo" node
268
269 $ hg archive ../archive-null
270 $ cat ../archive-null/.hg_archival.txt
271 repo: 1f0dee641bb7258c56bd60e93edfa2405381c41e
272 node: 7c3bad9141dcb46ff89abf5f61856facd56e476c
273 branch: default
274 latesttag: null
275 latesttagdistance: 2
276 changessincelatesttag: 2
253 277
254 278
255 279 $ cd ..
256 280
257 281 Exchange Test
258 282 ============================
259 283
260 284 Destination repo does not have any data
261 285 ---------------------------------------
262 286
263 287 Simple incoming test
264 288
265 289 $ hg init tmpc
266 290 $ cd tmpc
267 291 $ hg incoming ../tmpb
268 292 comparing with ../tmpb
269 293 0:1f0dee641bb7 (public) [ ] add a
270 294 1:7c3bad9141dc (public) [ ] add b
271 295 2:245bde4270cd (public) [ ] add original_c
272 296 6:6f9641995072 (draft) [tip ] add n3w_3_c
273 297
274 298 Try to pull markers
275 299 (extinct changeset are excluded but marker are pushed)
276 300
277 301 $ hg pull ../tmpb
278 302 pulling from ../tmpb
279 303 requesting all changes
280 304 adding changesets
281 305 adding manifests
282 306 adding file changes
283 307 added 4 changesets with 4 changes to 4 files (+1 heads)
284 308 (run 'hg heads' to see heads, 'hg merge' to merge)
285 309 $ hg debugobsolete
286 310 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
287 311 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
288 312 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
289 313 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
290 314 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
291 315
292 316 Rollback//Transaction support
293 317
294 318 $ hg debugobsolete -d '1340 0' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
295 319 $ hg debugobsolete
296 320 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
297 321 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
298 322 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
299 323 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
300 324 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
301 325 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0 (Thu Jan 01 00:22:20 1970 +0000) {'user': 'test'}
302 326 $ hg rollback -n
303 327 repository tip rolled back to revision 3 (undo debugobsolete)
304 328 $ hg rollback
305 329 repository tip rolled back to revision 3 (undo debugobsolete)
306 330 $ hg debugobsolete
307 331 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
308 332 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
309 333 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
310 334 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
311 335 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
312 336
313 337 $ cd ..
314 338
315 339 Try to push markers
316 340
317 341 $ hg init tmpd
318 342 $ hg -R tmpb push tmpd
319 343 pushing to tmpd
320 344 searching for changes
321 345 adding changesets
322 346 adding manifests
323 347 adding file changes
324 348 added 4 changesets with 4 changes to 4 files (+1 heads)
325 349 $ hg -R tmpd debugobsolete | sort
326 350 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
327 351 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
328 352 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
329 353 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
330 354 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
331 355
332 356 Check obsolete keys are exchanged only if source has an obsolete store
333 357
334 358 $ hg init empty
335 359 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
336 360 pushing to tmpd
337 361 listkeys phases
338 362 listkeys bookmarks
339 363 no changes found
340 364 listkeys phases
341 365 [1]
342 366
343 367 clone support
344 368 (markers are copied and extinct changesets are included to allow hardlinks)
345 369
346 370 $ hg clone tmpb clone-dest
347 371 updating to branch default
348 372 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
349 373 $ hg -R clone-dest log -G --hidden
350 374 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
351 375 |
352 376 | x 5:5601fb93a350 (draft) [ ] add new_3_c
353 377 |/
354 378 | x 4:ca819180edb9 (draft) [ ] add new_2_c
355 379 |/
356 380 | x 3:cdbce2fbb163 (draft) [ ] add new_c
357 381 |/
358 382 | o 2:245bde4270cd (public) [ ] add original_c
359 383 |/
360 384 o 1:7c3bad9141dc (public) [ ] add b
361 385 |
362 386 o 0:1f0dee641bb7 (public) [ ] add a
363 387
364 388 $ hg -R clone-dest debugobsolete
365 389 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
366 390 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
367 391 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
368 392 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
369 393 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
370 394
371 395
372 396 Destination repo have existing data
373 397 ---------------------------------------
374 398
375 399 On pull
376 400
377 401 $ hg init tmpe
378 402 $ cd tmpe
379 403 $ hg debugobsolete -d '1339 0' 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00
380 404 $ hg pull ../tmpb
381 405 pulling from ../tmpb
382 406 requesting all changes
383 407 adding changesets
384 408 adding manifests
385 409 adding file changes
386 410 added 4 changesets with 4 changes to 4 files (+1 heads)
387 411 (run 'hg heads' to see heads, 'hg merge' to merge)
388 412 $ hg debugobsolete
389 413 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
390 414 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
391 415 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
392 416 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
393 417 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
394 418 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
395 419
396 420
397 421 On push
398 422
399 423 $ hg push ../tmpc
400 424 pushing to ../tmpc
401 425 searching for changes
402 426 no changes found
403 427 [1]
404 428 $ hg -R ../tmpc debugobsolete
405 429 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
406 430 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
407 431 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
408 432 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
409 433 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
410 434 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
411 435
412 436 detect outgoing obsolete and unstable
413 437 ---------------------------------------
414 438
415 439
416 440 $ hg log -G
417 441 o 3:6f9641995072 (draft) [tip ] add n3w_3_c
418 442 |
419 443 | o 2:245bde4270cd (public) [ ] add original_c
420 444 |/
421 445 o 1:7c3bad9141dc (public) [ ] add b
422 446 |
423 447 o 0:1f0dee641bb7 (public) [ ] add a
424 448
425 449 $ hg up 'desc("n3w_3_c")'
426 450 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 451 $ mkcommit original_d
428 452 $ mkcommit original_e
429 453 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
430 454 $ hg debugobsolete | grep `getid original_d`
431 455 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
432 456 $ hg log -r 'obsolete()'
433 457 4:94b33453f93b (draft) [ ] add original_d
434 458 $ hg log -G -r '::unstable()'
435 459 @ 5:cda648ca50f5 (draft) [tip ] add original_e
436 460 |
437 461 x 4:94b33453f93b (draft) [ ] add original_d
438 462 |
439 463 o 3:6f9641995072 (draft) [ ] add n3w_3_c
440 464 |
441 465 o 1:7c3bad9141dc (public) [ ] add b
442 466 |
443 467 o 0:1f0dee641bb7 (public) [ ] add a
444 468
445 469
446 470 refuse to push obsolete changeset
447 471
448 472 $ hg push ../tmpc/ -r 'desc("original_d")'
449 473 pushing to ../tmpc/
450 474 searching for changes
451 475 abort: push includes obsolete changeset: 94b33453f93b!
452 476 [255]
453 477
454 478 refuse to push unstable changeset
455 479
456 480 $ hg push ../tmpc/
457 481 pushing to ../tmpc/
458 482 searching for changes
459 483 abort: push includes unstable changeset: cda648ca50f5!
460 484 [255]
461 485
462 486 Test that extinct changeset are properly detected
463 487
464 488 $ hg log -r 'extinct()'
465 489
466 490 Don't try to push extinct changeset
467 491
468 492 $ hg init ../tmpf
469 493 $ hg out ../tmpf
470 494 comparing with ../tmpf
471 495 searching for changes
472 496 0:1f0dee641bb7 (public) [ ] add a
473 497 1:7c3bad9141dc (public) [ ] add b
474 498 2:245bde4270cd (public) [ ] add original_c
475 499 3:6f9641995072 (draft) [ ] add n3w_3_c
476 500 4:94b33453f93b (draft) [ ] add original_d
477 501 5:cda648ca50f5 (draft) [tip ] add original_e
478 502 $ hg push ../tmpf -f # -f because be push unstable too
479 503 pushing to ../tmpf
480 504 searching for changes
481 505 adding changesets
482 506 adding manifests
483 507 adding file changes
484 508 added 6 changesets with 6 changes to 6 files (+1 heads)
485 509
486 510 no warning displayed
487 511
488 512 $ hg push ../tmpf
489 513 pushing to ../tmpf
490 514 searching for changes
491 515 no changes found
492 516 [1]
493 517
494 518 Do not warn about new head when the new head is a successors of a remote one
495 519
496 520 $ hg log -G
497 521 @ 5:cda648ca50f5 (draft) [tip ] add original_e
498 522 |
499 523 x 4:94b33453f93b (draft) [ ] add original_d
500 524 |
501 525 o 3:6f9641995072 (draft) [ ] add n3w_3_c
502 526 |
503 527 | o 2:245bde4270cd (public) [ ] add original_c
504 528 |/
505 529 o 1:7c3bad9141dc (public) [ ] add b
506 530 |
507 531 o 0:1f0dee641bb7 (public) [ ] add a
508 532
509 533 $ hg up -q 'desc(n3w_3_c)'
510 534 $ mkcommit obsolete_e
511 535 created new head
512 536 $ hg debugobsolete `getid 'original_e'` `getid 'obsolete_e'`
513 537 $ hg outgoing ../tmpf # parasite hg outgoing testin
514 538 comparing with ../tmpf
515 539 searching for changes
516 540 6:3de5eca88c00 (draft) [tip ] add obsolete_e
517 541 $ hg push ../tmpf
518 542 pushing to ../tmpf
519 543 searching for changes
520 544 adding changesets
521 545 adding manifests
522 546 adding file changes
523 547 added 1 changesets with 1 changes to 1 files (+1 heads)
524 548
525 549 test relevance computation
526 550 ---------------------------------------
527 551
528 552 Checking simple case of "marker relevance".
529 553
530 554
531 555 Reminder of the repo situation
532 556
533 557 $ hg log --hidden --graph
534 558 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
535 559 |
536 560 | x 5:cda648ca50f5 (draft) [ ] add original_e
537 561 | |
538 562 | x 4:94b33453f93b (draft) [ ] add original_d
539 563 |/
540 564 o 3:6f9641995072 (draft) [ ] add n3w_3_c
541 565 |
542 566 | o 2:245bde4270cd (public) [ ] add original_c
543 567 |/
544 568 o 1:7c3bad9141dc (public) [ ] add b
545 569 |
546 570 o 0:1f0dee641bb7 (public) [ ] add a
547 571
548 572
549 573 List of all markers
550 574
551 575 $ hg debugobsolete
552 576 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
553 577 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
554 578 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
555 579 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
556 580 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
557 581 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
558 582 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
559 583 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
560 584
561 585 List of changesets with no chain
562 586
563 587 $ hg debugobsolete --hidden --rev ::2
564 588
565 589 List of changesets that are included on marker chain
566 590
567 591 $ hg debugobsolete --hidden --rev 6
568 592 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
569 593
570 594 List of changesets with a longer chain, (including a pruned children)
571 595
572 596 $ hg debugobsolete --hidden --rev 3
573 597 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
574 598 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
575 599 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
576 600 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
577 601 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
578 602 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
579 603 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
580 604
581 605 List of both
582 606
583 607 $ hg debugobsolete --hidden --rev 3::6
584 608 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
585 609 1339133913391339133913391339133913391339 ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:19 1970 +0000) {'user': 'test'}
586 610 245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Thu Jan 01 00:00:01 1970 -0002) {'user': 'test'}
587 611 5601fb93a350734d935195fee37f4054c529ff39 6f96419950729f3671185b847352890f074f7557 1 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
588 612 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
589 613 ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 (Thu Jan 01 00:22:18 1970 +0000) {'user': 'test'}
590 614 cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
591 615 cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
592 616
593 617 #if serve
594 618
595 619 check hgweb does not explode
596 620 ====================================
597 621
598 622 $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
599 623 adding changesets
600 624 adding manifests
601 625 adding file changes
602 626 added 62 changesets with 63 changes to 9 files (+60 heads)
603 627 (run 'hg heads .' to see heads, 'hg merge' to merge)
604 628 $ for node in `hg log -r 'desc(babar_)' --template '{node}\n'`;
605 629 > do
606 630 > hg debugobsolete $node
607 631 > done
608 632 $ hg up tip
609 633 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
610 634
611 635 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
612 636 $ cat hg.pid >> $DAEMON_PIDS
613 637
614 638 check changelog view
615 639
616 640 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
617 641 200 Script output follows
618 642
619 643 check graph view
620 644
621 645 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
622 646 200 Script output follows
623 647
624 648 check filelog view
625 649
626 650 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar'
627 651 200 Script output follows
628 652
629 653 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68'
630 654 200 Script output follows
631 655 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
632 656 404 Not Found
633 657 [1]
634 658
635 659 check that web.view config option:
636 660
637 661 $ "$TESTDIR/killdaemons.py" hg.pid
638 662 $ cat >> .hg/hgrc << EOF
639 663 > [web]
640 664 > view=all
641 665 > EOF
642 666 $ wait
643 667 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
644 668 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/67'
645 669 200 Script output follows
646 670 $ "$TESTDIR/killdaemons.py" hg.pid
647 671
648 672 Checking _enable=False warning if obsolete marker exists
649 673
650 674 $ echo '[experimental]' >> $HGRCPATH
651 675 $ echo "evolution=" >> $HGRCPATH
652 676 $ hg log -r tip
653 677 obsolete feature not enabled but 68 markers found!
654 678 68:c15e9edfca13 (draft) [tip ] add celestine
655 679
656 680 reenable for later test
657 681
658 682 $ echo '[experimental]' >> $HGRCPATH
659 683 $ echo "evolution=createmarkers,exchange" >> $HGRCPATH
660 684
661 685 #endif
662 686
663 687 Test incoming/outcoming with changesets obsoleted remotely, known locally
664 688 ===============================================================================
665 689
666 690 This test issue 3805
667 691
668 692 $ hg init repo-issue3805
669 693 $ cd repo-issue3805
670 694 $ echo "foo" > foo
671 695 $ hg ci -Am "A"
672 696 adding foo
673 697 $ hg clone . ../other-issue3805
674 698 updating to branch default
675 699 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
676 700 $ echo "bar" >> foo
677 701 $ hg ci --amend
678 702 $ cd ../other-issue3805
679 703 $ hg log -G
680 704 @ 0:193e9254ce7e (draft) [tip ] A
681 705
682 706 $ hg log -G -R ../repo-issue3805
683 707 @ 2:3816541e5485 (draft) [tip ] A
684 708
685 709 $ hg incoming
686 710 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
687 711 searching for changes
688 712 2:3816541e5485 (draft) [tip ] A
689 713 $ hg incoming --bundle ../issue3805.hg
690 714 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
691 715 searching for changes
692 716 2:3816541e5485 (draft) [tip ] A
693 717 $ hg outgoing
694 718 comparing with $TESTTMP/tmpe/repo-issue3805 (glob)
695 719 searching for changes
696 720 no changes found
697 721 [1]
698 722
699 723 #if serve
700 724
701 725 $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
702 726 $ cat hg.pid >> $DAEMON_PIDS
703 727
704 728 $ hg incoming http://localhost:$HGPORT
705 729 comparing with http://localhost:$HGPORT/
706 730 searching for changes
707 731 1:3816541e5485 (draft) [tip ] A
708 732 $ hg outgoing http://localhost:$HGPORT
709 733 comparing with http://localhost:$HGPORT/
710 734 searching for changes
711 735 no changes found
712 736 [1]
713 737
714 738 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
715 739
716 740 #endif
717 741
718 742 This test issue 3814
719 743
720 744 (nothing to push but locally hidden changeset)
721 745
722 746 $ cd ..
723 747 $ hg init repo-issue3814
724 748 $ cd repo-issue3805
725 749 $ hg push -r 3816541e5485 ../repo-issue3814
726 750 pushing to ../repo-issue3814
727 751 searching for changes
728 752 adding changesets
729 753 adding manifests
730 754 adding file changes
731 755 added 1 changesets with 1 changes to 1 files
732 756 $ hg out ../repo-issue3814
733 757 comparing with ../repo-issue3814
734 758 searching for changes
735 759 no changes found
736 760 [1]
737 761
738 762 Test that a local tag blocks a changeset from being hidden
739 763
740 764 $ hg tag -l visible -r 0 --hidden
741 765 $ hg log -G
742 766 @ 2:3816541e5485 (draft) [tip ] A
743 767
744 768 x 0:193e9254ce7e (draft) [visible ] A
745 769
746 770 Test that removing a local tag does not cause some commands to fail
747 771
748 772 $ hg tag -l -r tip tiptag
749 773 $ hg tags
750 774 tiptag 2:3816541e5485
751 775 tip 2:3816541e5485
752 776 visible 0:193e9254ce7e
753 777 $ hg --config extensions.strip= strip -r tip --no-backup
754 778 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
755 779 $ hg tags
756 780 visible 0:193e9254ce7e
757 781 tip 0:193e9254ce7e
758 782
759 783 #if serve
760 784
761 785 Test issue 4506
762 786
763 787 $ cd ..
764 788 $ hg init repo-issue4506
765 789 $ cd repo-issue4506
766 790 $ echo "0" > foo
767 791 $ hg add foo
768 792 $ hg ci -m "content-0"
769 793
770 794 $ hg up null
771 795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
772 796 $ echo "1" > bar
773 797 $ hg add bar
774 798 $ hg ci -m "content-1"
775 799 created new head
776 800 $ hg up 0
777 801 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
778 802 $ hg graft 1
779 803 grafting 1:1c9eddb02162 "content-1" (tip)
780 804
781 805 $ hg debugobsolete `hg log -r1 -T'{node}'` `hg log -r2 -T'{node}'`
782 806
783 807 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
784 808 $ cat hg.pid >> $DAEMON_PIDS
785 809
786 810 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/1'
787 811 404 Not Found
788 812 [1]
789 813 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'file/tip/bar'
790 814 200 Script output follows
791 815 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'annotate/tip/bar'
792 816 200 Script output follows
793 817
794 818 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
795 819
796 820 #endif
797 821
General Comments 0
You need to be logged in to leave comments. Login now