##// END OF EJS Templates
blackbox: store the blackbox ui object instead of the log file...
timeless -
r28247:d2c0527a default
parent child Browse files
Show More
@@ -1,216 +1,220
1 # blackbox.py - log repository events to a file for post-mortem debugging
1 # blackbox.py - log repository events to a file for post-mortem debugging
2 #
2 #
3 # Copyright 2010 Nicolas Dumazet
3 # Copyright 2010 Nicolas Dumazet
4 # Copyright 2013 Facebook, Inc.
4 # Copyright 2013 Facebook, Inc.
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 """log repository events to a blackbox for debugging
9 """log repository events to a blackbox for debugging
10
10
11 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
11 Logs event information to .hg/blackbox.log to help debug and diagnose problems.
12 The events that get logged can be configured via the blackbox.track config key.
12 The events that get logged can be configured via the blackbox.track config key.
13
13
14 If you want to record whether the repository is dirty (a `+` sign, as you'd
14 If you want to record whether the repository is dirty (a `+` sign, as you'd
15 get when using :hg:`id`), you can set the blackbox.dirty config key.
15 get when using :hg:`id`), you can set the blackbox.dirty config key.
16
16
17 Examples::
17 Examples::
18
18
19 [blackbox]
19 [blackbox]
20 track = *
20 track = *
21 dirty = True
21 dirty = True
22
22
23 [blackbox]
23 [blackbox]
24 track = command, commandfinish, commandexception, exthook, pythonhook
24 track = command, commandfinish, commandexception, exthook, pythonhook
25
25
26 [blackbox]
26 [blackbox]
27 track = incoming
27 track = incoming
28
28
29 [blackbox]
29 [blackbox]
30 # limit the size of a log file
30 # limit the size of a log file
31 maxsize = 1.5 MB
31 maxsize = 1.5 MB
32 # rotate up to N log files when the current one gets too big
32 # rotate up to N log files when the current one gets too big
33 maxfiles = 3
33 maxfiles = 3
34
34
35 """
35 """
36
36
37 from __future__ import absolute_import
37 from __future__ import absolute_import
38
38
39 import errno
39 import errno
40 import re
40 import re
41
41
42 from mercurial.i18n import _
42 from mercurial.i18n import _
43 from mercurial.node import hex
43 from mercurial.node import hex
44
44
45 from mercurial import (
45 from mercurial import (
46 cmdutil,
46 cmdutil,
47 util,
47 util,
48 )
48 )
49
49
50 cmdtable = {}
50 cmdtable = {}
51 command = cmdutil.command(cmdtable)
51 command = cmdutil.command(cmdtable)
52 # Note for extension authors: ONLY specify testedwith = 'internal' for
52 # Note for extension authors: ONLY specify testedwith = 'internal' for
53 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
53 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
54 # be specifying the version(s) of Mercurial they are tested with, or
54 # be specifying the version(s) of Mercurial they are tested with, or
55 # leave the attribute unspecified.
55 # leave the attribute unspecified.
56 testedwith = 'internal'
56 testedwith = 'internal'
57 lastfp = None
57 lastui = None
58
58
59 filehandles = {}
59 filehandles = {}
60
60
61 def _openlog(vfs):
61 def _openlog(vfs):
62 path = vfs.join('blackbox.log')
62 path = vfs.join('blackbox.log')
63 if path in filehandles:
63 if path in filehandles:
64 return filehandles[path]
64 return filehandles[path]
65 filehandles[path] = fp = vfs('blackbox.log', 'a')
65 filehandles[path] = fp = vfs('blackbox.log', 'a')
66 return fp
66 return fp
67
67
68 def _closelog(vfs):
68 def _closelog(vfs):
69 path = vfs.join('blackbox.log')
69 path = vfs.join('blackbox.log')
70 fp = filehandles[path]
70 fp = filehandles[path]
71 del filehandles[path]
71 del filehandles[path]
72 fp.close()
72 fp.close()
73
73
74 def hexfn(node):
74 def hexfn(node):
75 if node is None:
75 if node is None:
76 return None
76 return None
77 else:
77 else:
78 return hex(node)
78 return hex(node)
79
79
80 def wrapui(ui):
80 def wrapui(ui):
81 class blackboxui(ui.__class__):
81 class blackboxui(ui.__class__):
82 @util.propertycache
82 @util.propertycache
83 def track(self):
83 def track(self):
84 return self.configlist('blackbox', 'track', ['*'])
84 return self.configlist('blackbox', 'track', ['*'])
85
85
86 def _openlogfile(self):
86 def _openlogfile(self):
87 def rotate(oldpath, newpath):
87 def rotate(oldpath, newpath):
88 try:
88 try:
89 self._bbvfs.unlink(newpath)
89 self._bbvfs.unlink(newpath)
90 except OSError as err:
90 except OSError as err:
91 if err.errno != errno.ENOENT:
91 if err.errno != errno.ENOENT:
92 self.debug("warning: cannot remove '%s': %s\n" %
92 self.debug("warning: cannot remove '%s': %s\n" %
93 (newpath, err.strerror))
93 (newpath, err.strerror))
94 try:
94 try:
95 if newpath:
95 if newpath:
96 self._bbvfs.rename(oldpath, newpath)
96 self._bbvfs.rename(oldpath, newpath)
97 except OSError as err:
97 except OSError as err:
98 if err.errno != errno.ENOENT:
98 if err.errno != errno.ENOENT:
99 self.debug("warning: cannot rename '%s' to '%s': %s\n" %
99 self.debug("warning: cannot rename '%s' to '%s': %s\n" %
100 (newpath, oldpath, err.strerror))
100 (newpath, oldpath, err.strerror))
101
101
102 fp = _openlog(self._bbvfs)
102 fp = _openlog(self._bbvfs)
103 maxsize = self.configbytes('blackbox', 'maxsize', 1048576)
103 maxsize = self.configbytes('blackbox', 'maxsize', 1048576)
104 if maxsize > 0:
104 if maxsize > 0:
105 st = self._bbvfs.fstat(fp)
105 st = self._bbvfs.fstat(fp)
106 if st.st_size >= maxsize:
106 if st.st_size >= maxsize:
107 path = fp.name
107 path = fp.name
108 _closelog(self._bbvfs)
108 _closelog(self._bbvfs)
109 maxfiles = self.configint('blackbox', 'maxfiles', 7)
109 maxfiles = self.configint('blackbox', 'maxfiles', 7)
110 for i in xrange(maxfiles - 1, 1, -1):
110 for i in xrange(maxfiles - 1, 1, -1):
111 rotate(oldpath='%s.%d' % (path, i - 1),
111 rotate(oldpath='%s.%d' % (path, i - 1),
112 newpath='%s.%d' % (path, i))
112 newpath='%s.%d' % (path, i))
113 rotate(oldpath=path,
113 rotate(oldpath=path,
114 newpath=maxfiles > 0 and path + '.1')
114 newpath=maxfiles > 0 and path + '.1')
115 fp = _openlog(self._bbvfs)
115 fp = _openlog(self._bbvfs)
116 return fp
116 return fp
117
117
118 def _bbwrite(self, fmt, *args):
119 self._bbfp.write(fmt % args)
120 self._bbfp.flush()
121
118 def log(self, event, *msg, **opts):
122 def log(self, event, *msg, **opts):
119 global lastfp
123 global lastui
120 super(blackboxui, self).log(event, *msg, **opts)
124 super(blackboxui, self).log(event, *msg, **opts)
121
125
122 if not '*' in self.track and not event in self.track:
126 if not '*' in self.track and not event in self.track:
123 return
127 return
124
128
125 if util.safehasattr(self, '_blackbox'):
129 if util.safehasattr(self, '_bbfp'):
126 fp = self._blackbox
130 ui = self
127 elif util.safehasattr(self, '_bbvfs'):
131 elif util.safehasattr(self, '_bbvfs'):
128 try:
132 try:
129 self._bbfp = self._openlogfile()
133 self._bbfp = self._openlogfile()
130 except (IOError, OSError) as err:
134 except (IOError, OSError) as err:
131 self.debug('warning: cannot write to blackbox.log: %s\n' %
135 self.debug('warning: cannot write to blackbox.log: %s\n' %
132 err.strerror)
136 err.strerror)
133 del self._bbvfs
137 del self._bbvfs
134 self._bbfp = None
138 self._bbfp = None
135 fp = self._bbfp
139 ui = self
136 else:
140 else:
137 # certain ui instances exist outside the context of
141 # certain ui instances exist outside the context of
138 # a repo, so just default to the last blackbox that
142 # a repo, so just default to the last blackbox that
139 # was seen.
143 # was seen.
140 fp = lastfp
144 ui = lastui
141
145
142 if fp:
146 if (util.safehasattr(ui, '_bbfp') and
147 ui._bbfp is not None):
143 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
148 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
144 user = util.getuser()
149 user = util.getuser()
145 pid = str(util.getpid())
150 pid = str(util.getpid())
146 formattedmsg = msg[0] % msg[1:]
151 formattedmsg = msg[0] % msg[1:]
147 rev = '(unknown)'
152 rev = '(unknown)'
148 changed = ''
153 changed = ''
149 if util.safehasattr(self, '_bbrepo'):
154 if util.safehasattr(ui, '_bbrepo'):
150 ctx = self._bbrepo[None]
155 ctx = ui._bbrepo[None]
151 if ctx.rev() is not None:
156 if ctx.rev() is not None:
152 rev = hexfn(ctx.node())
157 rev = hexfn(ctx.node())
153 else:
158 else:
154 parents = ctx.parents()
159 parents = ctx.parents()
155 rev = ('+'.join([hexfn(p.node()) for p in parents]))
160 rev = ('+'.join([hexfn(p.node()) for p in parents]))
156 if (self.configbool('blackbox', 'dirty', False) and (
161 if (ui.configbool('blackbox', 'dirty', False) and (
157 any(self._bbrepo.status()) or
162 any(ui._bbrepo.status()) or
158 any(ctx.sub(s).dirty() for s in ctx.substate)
163 any(ctx.sub(s).dirty() for s in ctx.substate)
159 )):
164 )):
160 changed = '+'
165 changed = '+'
161 try:
166 try:
162 fp.write('%s %s @%s%s (%s)> %s' %
167 ui._bbwrite('%s %s @%s%s (%s)> %s',
163 (date, user, rev, changed, pid, formattedmsg))
168 date, user, rev, changed, pid, formattedmsg)
164 fp.flush()
165 except IOError as err:
169 except IOError as err:
166 self.debug('warning: cannot write to blackbox.log: %s\n' %
170 self.debug('warning: cannot write to blackbox.log: %s\n' %
167 err.strerror)
171 err.strerror)
168 if not lastfp or util.safehasattr(self, '_bbrepo'):
172 if not lastui or util.safehasattr(ui, '_bbrepo'):
169 lastfp = fp
173 lastui = ui
170
174
171 def setrepo(self, repo):
175 def setrepo(self, repo):
172 self._bbvfs = repo.vfs
176 self._bbvfs = repo.vfs
173 self._bbrepo = repo
177 self._bbrepo = repo
174
178
175 ui.__class__ = blackboxui
179 ui.__class__ = blackboxui
176
180
177 def uisetup(ui):
181 def uisetup(ui):
178 wrapui(ui)
182 wrapui(ui)
179
183
180 def reposetup(ui, repo):
184 def reposetup(ui, repo):
181 # During 'hg pull' a httppeer repo is created to represent the remote repo.
185 # During 'hg pull' a httppeer repo is created to represent the remote repo.
182 # It doesn't have a .hg directory to put a blackbox in, so we don't do
186 # It doesn't have a .hg directory to put a blackbox in, so we don't do
183 # the blackbox setup for it.
187 # the blackbox setup for it.
184 if not repo.local():
188 if not repo.local():
185 return
189 return
186
190
187 if util.safehasattr(ui, 'setrepo'):
191 if util.safehasattr(ui, 'setrepo'):
188 ui.setrepo(repo)
192 ui.setrepo(repo)
189
193
190 @command('^blackbox',
194 @command('^blackbox',
191 [('l', 'limit', 10, _('the number of events to show')),
195 [('l', 'limit', 10, _('the number of events to show')),
192 ],
196 ],
193 _('hg blackbox [OPTION]...'))
197 _('hg blackbox [OPTION]...'))
194 def blackbox(ui, repo, *revs, **opts):
198 def blackbox(ui, repo, *revs, **opts):
195 '''view the recent repository events
199 '''view the recent repository events
196 '''
200 '''
197
201
198 if not repo.vfs.exists('blackbox.log'):
202 if not repo.vfs.exists('blackbox.log'):
199 return
203 return
200
204
201 limit = opts.get('limit')
205 limit = opts.get('limit')
202 fp = repo.vfs('blackbox.log', 'r')
206 fp = repo.vfs('blackbox.log', 'r')
203 lines = fp.read().split('\n')
207 lines = fp.read().split('\n')
204
208
205 count = 0
209 count = 0
206 output = []
210 output = []
207 for line in reversed(lines):
211 for line in reversed(lines):
208 if count >= limit:
212 if count >= limit:
209 break
213 break
210
214
211 # count the commands by matching lines like: 2013/01/23 19:13:36 root>
215 # count the commands by matching lines like: 2013/01/23 19:13:36 root>
212 if re.match('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line):
216 if re.match('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line):
213 count += 1
217 count += 1
214 output.append(line)
218 output.append(line)
215
219
216 ui.status('\n'.join(reversed(output)))
220 ui.status('\n'.join(reversed(output)))
@@ -1,189 +1,186
1 setup
1 setup
2 $ cat >> $HGRCPATH <<EOF
2 $ cat >> $HGRCPATH <<EOF
3 > [extensions]
3 > [extensions]
4 > blackbox=
4 > blackbox=
5 > mock=$TESTDIR/mockblackbox.py
5 > mock=$TESTDIR/mockblackbox.py
6 > mq=
6 > mq=
7 > EOF
7 > EOF
8 $ hg init blackboxtest
8 $ hg init blackboxtest
9 $ cd blackboxtest
9 $ cd blackboxtest
10
10
11 command, exit codes, and duration
11 command, exit codes, and duration
12
12
13 $ echo a > a
13 $ echo a > a
14 $ hg add a
14 $ hg add a
15 $ hg id --config blackbox.dirty=True > /dev/null
16 $ hg blackbox --config blackbox.dirty=True
15 $ hg blackbox --config blackbox.dirty=True
17 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
16 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a
18 1970/01/01 00:00:00 bob @(unknown) (5000)> add a exited 0 after * seconds (glob)
17 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> add a exited 0 after * seconds (glob)
19 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> id
20 1970/01/01 00:00:00 bob @(unknown) (5000)> id --config blackbox.dirty=True exited 0 after * seconds (glob)
21 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
18 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000+ (5000)> blackbox
22
19
23 incoming change tracking
20 incoming change tracking
24
21
25 create two heads to verify that we only see one change in the log later
22 create two heads to verify that we only see one change in the log later
26 $ hg commit -ma
23 $ hg commit -ma
27 $ hg up null
24 $ hg up null
28 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
29 $ echo b > b
26 $ echo b > b
30 $ hg commit -Amb
27 $ hg commit -Amb
31 adding b
28 adding b
32 created new head
29 created new head
33
30
34 clone, commit, pull
31 clone, commit, pull
35 $ hg clone . ../blackboxtest2
32 $ hg clone . ../blackboxtest2
36 updating to branch default
33 updating to branch default
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 $ echo c > c
35 $ echo c > c
39 $ hg commit -Amc
36 $ hg commit -Amc
40 adding c
37 adding c
41 $ cd ../blackboxtest2
38 $ cd ../blackboxtest2
42 $ hg pull
39 $ hg pull
43 pulling from $TESTTMP/blackboxtest (glob)
40 pulling from $TESTTMP/blackboxtest (glob)
44 searching for changes
41 searching for changes
45 adding changesets
42 adding changesets
46 adding manifests
43 adding manifests
47 adding file changes
44 adding file changes
48 added 1 changesets with 1 changes to 1 files
45 added 1 changesets with 1 changes to 1 files
49 (run 'hg update' to get a working copy)
46 (run 'hg update' to get a working copy)
50 $ hg blackbox -l 6
47 $ hg blackbox -l 6
51 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
48 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
52 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
49 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
53 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
50 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
54 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
51 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
55 1970/01/01 00:00:00 bob @(unknown) (5000)> pull exited 0 after * seconds (glob)
52 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob)
56 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
53 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
57
54
58 we must not cause a failure if we cannot write to the log
55 we must not cause a failure if we cannot write to the log
59
56
60 $ hg rollback
57 $ hg rollback
61 repository tip rolled back to revision 1 (undo pull)
58 repository tip rolled back to revision 1 (undo pull)
62
59
63 $ mv .hg/blackbox.log .hg/blackbox.log-
60 $ mv .hg/blackbox.log .hg/blackbox.log-
64 $ mkdir .hg/blackbox.log
61 $ mkdir .hg/blackbox.log
65 $ hg --debug incoming
62 $ hg --debug incoming
66 warning: cannot write to blackbox.log: * (glob)
63 warning: cannot write to blackbox.log: * (glob)
67 comparing with $TESTTMP/blackboxtest (glob)
64 comparing with $TESTTMP/blackboxtest (glob)
68 query 1; heads
65 query 1; heads
69 searching for changes
66 searching for changes
70 all local heads known remotely
67 all local heads known remotely
71 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
68 changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
72 tag: tip
69 tag: tip
73 phase: draft
70 phase: draft
74 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
71 parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
75 parent: -1:0000000000000000000000000000000000000000
72 parent: -1:0000000000000000000000000000000000000000
76 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
73 manifest: 2:ab9d46b053ebf45b7996f2922b9893ff4b63d892
77 user: test
74 user: test
78 date: Thu Jan 01 00:00:00 1970 +0000
75 date: Thu Jan 01 00:00:00 1970 +0000
79 files+: c
76 files+: c
80 extra: branch=default
77 extra: branch=default
81 description:
78 description:
82 c
79 c
83
80
84
81
85 $ hg pull
82 $ hg pull
86 pulling from $TESTTMP/blackboxtest (glob)
83 pulling from $TESTTMP/blackboxtest (glob)
87 searching for changes
84 searching for changes
88 adding changesets
85 adding changesets
89 adding manifests
86 adding manifests
90 adding file changes
87 adding file changes
91 added 1 changesets with 1 changes to 1 files
88 added 1 changesets with 1 changes to 1 files
92 (run 'hg update' to get a working copy)
89 (run 'hg update' to get a working copy)
93
90
94 a failure reading from the log is fatal
91 a failure reading from the log is fatal
95
92
96 $ hg blackbox -l 3
93 $ hg blackbox -l 3
97 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
94 abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
98 [255]
95 [255]
99
96
100 $ rmdir .hg/blackbox.log
97 $ rmdir .hg/blackbox.log
101 $ mv .hg/blackbox.log- .hg/blackbox.log
98 $ mv .hg/blackbox.log- .hg/blackbox.log
102
99
103 backup bundles get logged
100 backup bundles get logged
104
101
105 $ touch d
102 $ touch d
106 $ hg commit -Amd
103 $ hg commit -Amd
107 adding d
104 adding d
108 created new head
105 created new head
109 $ hg strip tip
106 $ hg strip tip
110 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
107 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
111 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
108 saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
112 $ hg blackbox -l 6
109 $ hg blackbox -l 6
113 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
110 1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
114 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg
111 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg
115 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
112 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated base branch cache in * seconds (glob)
116 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
113 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote base branch cache with 1 labels and 2 nodes
117 1970/01/01 00:00:00 bob @(unknown) (5000)> strip tip exited 0 after * seconds (glob)
114 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
118 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
115 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
119
116
120 extension and python hooks - use the eol extension for a pythonhook
117 extension and python hooks - use the eol extension for a pythonhook
121
118
122 $ echo '[extensions]' >> .hg/hgrc
119 $ echo '[extensions]' >> .hg/hgrc
123 $ echo 'eol=' >> .hg/hgrc
120 $ echo 'eol=' >> .hg/hgrc
124 $ echo '[hooks]' >> .hg/hgrc
121 $ echo '[hooks]' >> .hg/hgrc
125 $ echo 'update = echo hooked' >> .hg/hgrc
122 $ echo 'update = echo hooked' >> .hg/hgrc
126 $ hg update
123 $ hg update
127 hooked
124 hooked
128 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
129 1 other heads for branch "default"
126 1 other heads for branch "default"
130 $ hg blackbox -l 6
127 $ hg blackbox -l 6
131 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update
128 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update
132 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags
129 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags
133 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
130 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob)
134 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob)
131 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob)
135 1970/01/01 00:00:00 bob @(unknown) (5000)> update exited 0 after * seconds (glob)
132 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob)
136 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6
133 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6
137
134
138 log rotation
135 log rotation
139
136
140 $ echo '[blackbox]' >> .hg/hgrc
137 $ echo '[blackbox]' >> .hg/hgrc
141 $ echo 'maxsize = 20 b' >> .hg/hgrc
138 $ echo 'maxsize = 20 b' >> .hg/hgrc
142 $ echo 'maxfiles = 3' >> .hg/hgrc
139 $ echo 'maxfiles = 3' >> .hg/hgrc
143 $ hg status
140 $ hg status
144 $ hg status
141 $ hg status
145 $ hg status
142 $ hg status
146 $ hg tip -q
143 $ hg tip -q
147 2:d02f48003e62
144 2:d02f48003e62
148 $ ls .hg/blackbox.log*
145 $ ls .hg/blackbox.log*
149 .hg/blackbox.log
146 .hg/blackbox.log
150 .hg/blackbox.log.1
147 .hg/blackbox.log.1
151 .hg/blackbox.log.2
148 .hg/blackbox.log.2
152 $ cd ..
149 $ cd ..
153
150
154 $ hg init blackboxtest3
151 $ hg init blackboxtest3
155 $ cd blackboxtest3
152 $ cd blackboxtest3
156 $ hg blackbox
153 $ hg blackbox
157 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
154 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
158 $ mv .hg/blackbox.log .hg/blackbox.log-
155 $ mv .hg/blackbox.log .hg/blackbox.log-
159 $ mkdir .hg/blackbox.log
156 $ mkdir .hg/blackbox.log
160 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\nos.rename(".hg/blackbox.log-", ".hg/blackbox.log")\n\1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
157 $ sed -e 's/\(.*test1.*\)/#\1/; s#\(.*commit2.*\)#os.rmdir(".hg/blackbox.log")\nos.rename(".hg/blackbox.log-", ".hg/blackbox.log")\n\1#' $TESTDIR/test-dispatch.py > ../test-dispatch.py
161 $ python ../test-dispatch.py
158 $ python ../test-dispatch.py
162 running: add foo
159 running: add foo
163 result: 0
160 result: 0
164 running: commit -m commit1 -d 2000-01-01 foo
161 running: commit -m commit1 -d 2000-01-01 foo
165 result: None
162 result: None
166 running: commit -m commit2 -d 2000-01-02 foo
163 running: commit -m commit2 -d 2000-01-02 foo
167 result: None
164 result: None
168 running: log -r 0
165 running: log -r 0
169 changeset: 0:0e4634943879
166 changeset: 0:0e4634943879
170 user: test
167 user: test
171 date: Sat Jan 01 00:00:00 2000 +0000
168 date: Sat Jan 01 00:00:00 2000 +0000
172 summary: commit1
169 summary: commit1
173
170
174 result: None
171 result: None
175 running: log -r tip
172 running: log -r tip
176 changeset: 1:45589e459b2e
173 changeset: 1:45589e459b2e
177 tag: tip
174 tag: tip
178 user: test
175 user: test
179 date: Sun Jan 02 00:00:00 2000 +0000
176 date: Sun Jan 02 00:00:00 2000 +0000
180 summary: commit2
177 summary: commit2
181
178
182 result: None
179 result: None
183 $ hg blackbox
180 $ hg blackbox
184 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
181 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox
185 1970/01/01 00:00:00 bob @(unknown) (5000)> blackbox exited 0 after * seconds (glob)
182 1970/01/01 00:00:00 bob @0000000000000000000000000000000000000000 (5000)> blackbox exited 0 after * seconds (glob)
186 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox
183 1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> blackbox
187
184
188 cleanup
185 cleanup
189 $ cd ..
186 $ cd ..
@@ -1,116 +1,116
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > blackbox=
3 > blackbox=
4 > rebase=
4 > rebase=
5 > mock=$TESTDIR/mockblackbox.py
5 > mock=$TESTDIR/mockblackbox.py
6 >
6 >
7 > [experimental]
7 > [experimental]
8 > evolution = createmarkers
8 > evolution = createmarkers
9 > EOF
9 > EOF
10
10
11 Create a repo with some tags
11 Create a repo with some tags
12
12
13 $ hg init repo
13 $ hg init repo
14 $ cd repo
14 $ cd repo
15 $ echo initial > foo
15 $ echo initial > foo
16 $ hg -q commit -A -m initial
16 $ hg -q commit -A -m initial
17 $ hg tag -m 'test tag' test1
17 $ hg tag -m 'test tag' test1
18 $ echo first > first
18 $ echo first > first
19 $ hg -q commit -A -m first
19 $ hg -q commit -A -m first
20 $ hg tag -m 'test2 tag' test2
20 $ hg tag -m 'test2 tag' test2
21 $ hg -q up -r 0
21 $ hg -q up -r 0
22 $ echo newhead > newhead
22 $ echo newhead > newhead
23 $ hg commit -A -m newhead
23 $ hg commit -A -m newhead
24 adding newhead
24 adding newhead
25 created new head
25 created new head
26 $ hg tag -m 'test head 2 tag' head2
26 $ hg tag -m 'test head 2 tag' head2
27
27
28 $ hg log -G -T '{rev}:{node|short} {tags} {desc}\n'
28 $ hg log -G -T '{rev}:{node|short} {tags} {desc}\n'
29 @ 5:2942a772f72a tip test head 2 tag
29 @ 5:2942a772f72a tip test head 2 tag
30 |
30 |
31 o 4:042eb6bfcc49 head2 newhead
31 o 4:042eb6bfcc49 head2 newhead
32 |
32 |
33 | o 3:c3cb30f2d2cd test2 tag
33 | o 3:c3cb30f2d2cd test2 tag
34 | |
34 | |
35 | o 2:d75775ffbc6b test2 first
35 | o 2:d75775ffbc6b test2 first
36 | |
36 | |
37 | o 1:5f97d42da03f test tag
37 | o 1:5f97d42da03f test tag
38 |/
38 |/
39 o 0:55482a6fb4b1 test1 initial
39 o 0:55482a6fb4b1 test1 initial
40
40
41
41
42 Trigger tags cache population by doing something that accesses tags info
42 Trigger tags cache population by doing something that accesses tags info
43
43
44 $ hg tags
44 $ hg tags
45 tip 5:2942a772f72a
45 tip 5:2942a772f72a
46 head2 4:042eb6bfcc49
46 head2 4:042eb6bfcc49
47 test2 2:d75775ffbc6b
47 test2 2:d75775ffbc6b
48 test1 0:55482a6fb4b1
48 test1 0:55482a6fb4b1
49
49
50 $ cat .hg/cache/tags2-visible
50 $ cat .hg/cache/tags2-visible
51 5 2942a772f72a444bef4bef13874d515f50fa27b6
51 5 2942a772f72a444bef4bef13874d515f50fa27b6
52 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
52 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
53 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
53 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
54 d75775ffbc6bca1794d300f5571272879bd280da test2
54 d75775ffbc6bca1794d300f5571272879bd280da test2
55
55
56 Hiding a non-tip changeset should change filtered hash and cause tags recompute
56 Hiding a non-tip changeset should change filtered hash and cause tags recompute
57
57
58 $ hg debugobsolete -d '0 0' c3cb30f2d2cd0aae008cc91a07876e3c5131fd22 -u dummyuser
58 $ hg debugobsolete -d '0 0' c3cb30f2d2cd0aae008cc91a07876e3c5131fd22 -u dummyuser
59
59
60 $ hg tags
60 $ hg tags
61 tip 5:2942a772f72a
61 tip 5:2942a772f72a
62 head2 4:042eb6bfcc49
62 head2 4:042eb6bfcc49
63 test1 0:55482a6fb4b1
63 test1 0:55482a6fb4b1
64
64
65 $ cat .hg/cache/tags2-visible
65 $ cat .hg/cache/tags2-visible
66 5 2942a772f72a444bef4bef13874d515f50fa27b6 f34fbc9a9769ba9eff5aff3d008a6b49f85c08b1
66 5 2942a772f72a444bef4bef13874d515f50fa27b6 f34fbc9a9769ba9eff5aff3d008a6b49f85c08b1
67 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
67 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
68 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
68 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
69
69
70 $ hg blackbox -l 5
70 $ hg blackbox -l 5
71 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> tags
71 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> tags
72 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> 2/2 cache hits/lookups in * seconds (glob)
72 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> 2/2 cache hits/lookups in * seconds (glob)
73 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> writing .hg/cache/tags2-visible with 2 tags
73 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> writing .hg/cache/tags2-visible with 2 tags
74 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
74 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> tags exited 0 after * seconds (glob)
75 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> blackbox -l 5
75 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> blackbox -l 5
76
76
77 Hiding another changeset should cause the filtered hash to change
77 Hiding another changeset should cause the filtered hash to change
78
78
79 $ hg debugobsolete -d '0 0' d75775ffbc6bca1794d300f5571272879bd280da -u dummyuser
79 $ hg debugobsolete -d '0 0' d75775ffbc6bca1794d300f5571272879bd280da -u dummyuser
80 $ hg debugobsolete -d '0 0' 5f97d42da03fd56f3b228b03dfe48af5c0adf75b -u dummyuser
80 $ hg debugobsolete -d '0 0' 5f97d42da03fd56f3b228b03dfe48af5c0adf75b -u dummyuser
81
81
82 $ hg tags
82 $ hg tags
83 tip 5:2942a772f72a
83 tip 5:2942a772f72a
84 head2 4:042eb6bfcc49
84 head2 4:042eb6bfcc49
85
85
86 $ cat .hg/cache/tags2-visible
86 $ cat .hg/cache/tags2-visible
87 5 2942a772f72a444bef4bef13874d515f50fa27b6 2fce1eec33263d08a4d04293960fc73a555230e4
87 5 2942a772f72a444bef4bef13874d515f50fa27b6 2fce1eec33263d08a4d04293960fc73a555230e4
88 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
88 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
89
89
90 $ hg blackbox -l 5
90 $ hg blackbox -l 5
91 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> tags
91 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> tags
92 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> 1/1 cache hits/lookups in * seconds (glob)
92 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> 1/1 cache hits/lookups in * seconds (glob)
93 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> writing .hg/cache/tags2-visible with 1 tags
93 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> writing .hg/cache/tags2-visible with 1 tags
94 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
94 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> tags exited 0 after * seconds (glob)
95 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> blackbox -l 5
95 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> blackbox -l 5
96
96
97 Resolving tags on an unfiltered repo writes a separate tags cache
97 Resolving tags on an unfiltered repo writes a separate tags cache
98
98
99 $ hg --hidden tags
99 $ hg --hidden tags
100 tip 5:2942a772f72a
100 tip 5:2942a772f72a
101 head2 4:042eb6bfcc49
101 head2 4:042eb6bfcc49
102 test2 2:d75775ffbc6b
102 test2 2:d75775ffbc6b
103 test1 0:55482a6fb4b1
103 test1 0:55482a6fb4b1
104
104
105 $ cat .hg/cache/tags2
105 $ cat .hg/cache/tags2
106 5 2942a772f72a444bef4bef13874d515f50fa27b6
106 5 2942a772f72a444bef4bef13874d515f50fa27b6
107 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
107 042eb6bfcc4909bad84a1cbf6eb1ddf0ab587d41 head2
108 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
108 55482a6fb4b1881fa8f746fd52cf6f096bb21c89 test1
109 d75775ffbc6bca1794d300f5571272879bd280da test2
109 d75775ffbc6bca1794d300f5571272879bd280da test2
110
110
111 $ hg blackbox -l 5
111 $ hg blackbox -l 5
112 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> --hidden tags
112 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> --hidden tags
113 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> 2/2 cache hits/lookups in * seconds (glob)
113 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> 2/2 cache hits/lookups in * seconds (glob)
114 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> writing .hg/cache/tags2 with 3 tags
114 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> writing .hg/cache/tags2 with 3 tags
115 1970/01/01 00:00:00 bob @(unknown) (5000)> --hidden tags exited 0 after * seconds (glob)
115 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> --hidden tags exited 0 after * seconds (glob)
116 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> blackbox -l 5
116 1970/01/01 00:00:00 bob @2942a772f72a444bef4bef13874d515f50fa27b6 (5000)> blackbox -l 5
@@ -1,716 +1,716
1 setup
1 setup
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > blackbox=
5 > blackbox=
6 > mock=$TESTDIR/mockblackbox.py
6 > mock=$TESTDIR/mockblackbox.py
7 > EOF
7 > EOF
8
8
9 Helper functions:
9 Helper functions:
10
10
11 $ cacheexists() {
11 $ cacheexists() {
12 > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache"
12 > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache"
13 > }
13 > }
14
14
15 $ fnodescacheexists() {
15 $ fnodescacheexists() {
16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
16 > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache"
17 > }
17 > }
18
18
19 $ dumptags() {
19 $ dumptags() {
20 > rev=$1
20 > rev=$1
21 > echo "rev $rev: .hgtags:"
21 > echo "rev $rev: .hgtags:"
22 > hg cat -r$rev .hgtags
22 > hg cat -r$rev .hgtags
23 > }
23 > }
24
24
25 # XXX need to test that the tag cache works when we strip an old head
25 # XXX need to test that the tag cache works when we strip an old head
26 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
26 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
27 # same, but stuff has changed behind tip.
27 # same, but stuff has changed behind tip.
28
28
29 Setup:
29 Setup:
30
30
31 $ hg init t
31 $ hg init t
32 $ cd t
32 $ cd t
33 $ cacheexists
33 $ cacheexists
34 no tag cache
34 no tag cache
35 $ fnodescacheexists
35 $ fnodescacheexists
36 no fnodes cache
36 no fnodes cache
37 $ hg id
37 $ hg id
38 000000000000 tip
38 000000000000 tip
39 $ cacheexists
39 $ cacheexists
40 no tag cache
40 no tag cache
41 $ fnodescacheexists
41 $ fnodescacheexists
42 no fnodes cache
42 no fnodes cache
43 $ echo a > a
43 $ echo a > a
44 $ hg add a
44 $ hg add a
45 $ hg commit -m "test"
45 $ hg commit -m "test"
46 $ hg co
46 $ hg co
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 $ hg identify
48 $ hg identify
49 acb14030fe0a tip
49 acb14030fe0a tip
50 $ hg identify -r 'wdir()'
50 $ hg identify -r 'wdir()'
51 acb14030fe0a tip
51 acb14030fe0a tip
52 $ cacheexists
52 $ cacheexists
53 tag cache exists
53 tag cache exists
54 No fnodes cache because .hgtags file doesn't exist
54 No fnodes cache because .hgtags file doesn't exist
55 (this is an implementation detail)
55 (this is an implementation detail)
56 $ fnodescacheexists
56 $ fnodescacheexists
57 no fnodes cache
57 no fnodes cache
58
58
59 Try corrupting the cache
59 Try corrupting the cache
60
60
61 $ printf 'a b' > .hg/cache/tags2-visible
61 $ printf 'a b' > .hg/cache/tags2-visible
62 $ hg identify
62 $ hg identify
63 acb14030fe0a tip
63 acb14030fe0a tip
64 $ cacheexists
64 $ cacheexists
65 tag cache exists
65 tag cache exists
66 $ fnodescacheexists
66 $ fnodescacheexists
67 no fnodes cache
67 no fnodes cache
68 $ hg identify
68 $ hg identify
69 acb14030fe0a tip
69 acb14030fe0a tip
70
70
71 Create local tag with long name:
71 Create local tag with long name:
72
72
73 $ T=`hg identify --debug --id`
73 $ T=`hg identify --debug --id`
74 $ hg tag -l "This is a local tag with a really long name!"
74 $ hg tag -l "This is a local tag with a really long name!"
75 $ hg tags
75 $ hg tags
76 tip 0:acb14030fe0a
76 tip 0:acb14030fe0a
77 This is a local tag with a really long name! 0:acb14030fe0a
77 This is a local tag with a really long name! 0:acb14030fe0a
78 $ rm .hg/localtags
78 $ rm .hg/localtags
79
79
80 Create a tag behind hg's back:
80 Create a tag behind hg's back:
81
81
82 $ echo "$T first" > .hgtags
82 $ echo "$T first" > .hgtags
83 $ cat .hgtags
83 $ cat .hgtags
84 acb14030fe0a21b60322c440ad2d20cf7685a376 first
84 acb14030fe0a21b60322c440ad2d20cf7685a376 first
85 $ hg add .hgtags
85 $ hg add .hgtags
86 $ hg commit -m "add tags"
86 $ hg commit -m "add tags"
87 $ hg tags
87 $ hg tags
88 tip 1:b9154636be93
88 tip 1:b9154636be93
89 first 0:acb14030fe0a
89 first 0:acb14030fe0a
90 $ hg identify
90 $ hg identify
91 b9154636be93 tip
91 b9154636be93 tip
92
92
93 We should have a fnodes cache now that we have a real tag
93 We should have a fnodes cache now that we have a real tag
94 The cache should have an empty entry for rev 0 and a valid entry for rev 1.
94 The cache should have an empty entry for rev 0 and a valid entry for rev 1.
95
95
96
96
97 $ fnodescacheexists
97 $ fnodescacheexists
98 fnodes cache exists
98 fnodes cache exists
99 $ f --size --hexdump .hg/cache/hgtagsfnodes1
99 $ f --size --hexdump .hg/cache/hgtagsfnodes1
100 .hg/cache/hgtagsfnodes1: size=48
100 .hg/cache/hgtagsfnodes1: size=48
101 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
101 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
102 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
102 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
103 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
103 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
104
104
105 Repeat with cold tag cache:
105 Repeat with cold tag cache:
106
106
107 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
107 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
108 $ hg identify
108 $ hg identify
109 b9154636be93 tip
109 b9154636be93 tip
110
110
111 $ fnodescacheexists
111 $ fnodescacheexists
112 fnodes cache exists
112 fnodes cache exists
113 $ f --size --hexdump .hg/cache/hgtagsfnodes1
113 $ f --size --hexdump .hg/cache/hgtagsfnodes1
114 .hg/cache/hgtagsfnodes1: size=48
114 .hg/cache/hgtagsfnodes1: size=48
115 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
115 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
116 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
116 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
117 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
117 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
118
118
119 And again, but now unable to write tag cache or lock file:
119 And again, but now unable to write tag cache or lock file:
120
120
121 #if unix-permissions
121 #if unix-permissions
122 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
122 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
123 $ chmod 555 .hg/cache
123 $ chmod 555 .hg/cache
124 $ hg identify
124 $ hg identify
125 b9154636be93 tip
125 b9154636be93 tip
126 $ chmod 755 .hg/cache
126 $ chmod 755 .hg/cache
127
127
128 $ chmod 555 .hg
128 $ chmod 555 .hg
129 $ hg identify
129 $ hg identify
130 b9154636be93 tip
130 b9154636be93 tip
131 $ chmod 755 .hg
131 $ chmod 755 .hg
132 #endif
132 #endif
133
133
134 Tag cache debug info written to blackbox log
134 Tag cache debug info written to blackbox log
135
135
136 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
136 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
137 $ hg identify
137 $ hg identify
138 b9154636be93 tip
138 b9154636be93 tip
139 $ hg blackbox -l 6
139 $ hg blackbox -l 6
140 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
140 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
141 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing 48 bytes to cache/hgtagsfnodes1
141 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing 48 bytes to cache/hgtagsfnodes1
142 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
142 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
143 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
143 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
144 1970/01/01 00:00:00 bob @(unknown) (5000)> identify exited 0 after * seconds (glob)
144 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify exited 0 after * seconds (glob)
145 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
145 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
146
146
147 Failure to acquire lock results in no write
147 Failure to acquire lock results in no write
148
148
149 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
149 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
150 $ echo 'foo:1' > .hg/wlock
150 $ echo 'foo:1' > .hg/wlock
151 $ hg identify
151 $ hg identify
152 b9154636be93 tip
152 b9154636be93 tip
153 $ hg blackbox -l 6
153 $ hg blackbox -l 6
154 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
154 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify
155 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired
155 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> not writing .hg/cache/hgtagsfnodes1 because lock cannot be acquired
156 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
156 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> 0/1 cache hits/lookups in * seconds (glob)
157 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
157 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> writing .hg/cache/tags2-visible with 1 tags
158 1970/01/01 00:00:00 bob @(unknown) (5000)> identify exited 0 after * seconds (glob)
158 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> identify exited 0 after * seconds (glob)
159 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
159 1970/01/01 00:00:00 bob @b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l 6
160
160
161 $ fnodescacheexists
161 $ fnodescacheexists
162 no fnodes cache
162 no fnodes cache
163
163
164 $ rm .hg/wlock
164 $ rm .hg/wlock
165
165
166 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
166 $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1
167 $ hg identify
167 $ hg identify
168 b9154636be93 tip
168 b9154636be93 tip
169
169
170 Create a branch:
170 Create a branch:
171
171
172 $ echo bb > a
172 $ echo bb > a
173 $ hg status
173 $ hg status
174 M a
174 M a
175 $ hg identify
175 $ hg identify
176 b9154636be93+ tip
176 b9154636be93+ tip
177 $ hg co first
177 $ hg co first
178 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
178 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
179 $ hg id
179 $ hg id
180 acb14030fe0a+ first
180 acb14030fe0a+ first
181 $ hg id -r 'wdir()'
181 $ hg id -r 'wdir()'
182 acb14030fe0a+ first
182 acb14030fe0a+ first
183 $ hg -v id
183 $ hg -v id
184 acb14030fe0a+ first
184 acb14030fe0a+ first
185 $ hg status
185 $ hg status
186 M a
186 M a
187 $ echo 1 > b
187 $ echo 1 > b
188 $ hg add b
188 $ hg add b
189 $ hg commit -m "branch"
189 $ hg commit -m "branch"
190 created new head
190 created new head
191
191
192 Creating a new commit shouldn't append the .hgtags fnodes cache until
192 Creating a new commit shouldn't append the .hgtags fnodes cache until
193 tags info is accessed
193 tags info is accessed
194
194
195 $ f --size --hexdump .hg/cache/hgtagsfnodes1
195 $ f --size --hexdump .hg/cache/hgtagsfnodes1
196 .hg/cache/hgtagsfnodes1: size=48
196 .hg/cache/hgtagsfnodes1: size=48
197 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
197 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
198 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
198 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
199 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
199 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
200
200
201 $ hg id
201 $ hg id
202 c8edf04160c7 tip
202 c8edf04160c7 tip
203
203
204 First 4 bytes of record 3 are changeset fragment
204 First 4 bytes of record 3 are changeset fragment
205
205
206 $ f --size --hexdump .hg/cache/hgtagsfnodes1
206 $ f --size --hexdump .hg/cache/hgtagsfnodes1
207 .hg/cache/hgtagsfnodes1: size=72
207 .hg/cache/hgtagsfnodes1: size=72
208 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
208 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
209 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
209 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
210 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
210 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
211 0030: c8 ed f0 41 00 00 00 00 00 00 00 00 00 00 00 00 |...A............|
211 0030: c8 ed f0 41 00 00 00 00 00 00 00 00 00 00 00 00 |...A............|
212 0040: 00 00 00 00 00 00 00 00 |........|
212 0040: 00 00 00 00 00 00 00 00 |........|
213
213
214 Merge the two heads:
214 Merge the two heads:
215
215
216 $ hg merge 1
216 $ hg merge 1
217 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 (branch merge, don't forget to commit)
218 (branch merge, don't forget to commit)
219 $ hg blackbox -l3
219 $ hg blackbox -l3
220 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28 (5000)> merge 1
220 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28 (5000)> merge 1
221 1970/01/01 00:00:00 bob @(unknown) (5000)> merge 1 exited 0 after * seconds (glob)
221 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> merge 1 exited 0 after * seconds (glob)
222 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l3
222 1970/01/01 00:00:00 bob @c8edf04160c7f731e4589d66ab3ab3486a64ac28+b9154636be938d3d431e75a7c906504a079bfe07 (5000)> blackbox -l3
223 $ hg id
223 $ hg id
224 c8edf04160c7+b9154636be93+ tip
224 c8edf04160c7+b9154636be93+ tip
225 $ hg status
225 $ hg status
226 M .hgtags
226 M .hgtags
227 $ hg commit -m "merge"
227 $ hg commit -m "merge"
228
228
229 Create a fake head, make sure tag not visible afterwards:
229 Create a fake head, make sure tag not visible afterwards:
230
230
231 $ cp .hgtags tags
231 $ cp .hgtags tags
232 $ hg tag last
232 $ hg tag last
233 $ hg rm .hgtags
233 $ hg rm .hgtags
234 $ hg commit -m "remove"
234 $ hg commit -m "remove"
235
235
236 $ mv tags .hgtags
236 $ mv tags .hgtags
237 $ hg add .hgtags
237 $ hg add .hgtags
238 $ hg commit -m "readd"
238 $ hg commit -m "readd"
239 $
239 $
240 $ hg tags
240 $ hg tags
241 tip 6:35ff301afafe
241 tip 6:35ff301afafe
242 first 0:acb14030fe0a
242 first 0:acb14030fe0a
243
243
244 Add invalid tags:
244 Add invalid tags:
245
245
246 $ echo "spam" >> .hgtags
246 $ echo "spam" >> .hgtags
247 $ echo >> .hgtags
247 $ echo >> .hgtags
248 $ echo "foo bar" >> .hgtags
248 $ echo "foo bar" >> .hgtags
249 $ echo "a5a5 invalid" >> .hg/localtags
249 $ echo "a5a5 invalid" >> .hg/localtags
250 $ cat .hgtags
250 $ cat .hgtags
251 acb14030fe0a21b60322c440ad2d20cf7685a376 first
251 acb14030fe0a21b60322c440ad2d20cf7685a376 first
252 spam
252 spam
253
253
254 foo bar
254 foo bar
255 $ hg commit -m "tags"
255 $ hg commit -m "tags"
256
256
257 Report tag parse error on other head:
257 Report tag parse error on other head:
258
258
259 $ hg up 3
259 $ hg up 3
260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ echo 'x y' >> .hgtags
261 $ echo 'x y' >> .hgtags
262 $ hg commit -m "head"
262 $ hg commit -m "head"
263 created new head
263 created new head
264
264
265 $ hg tags
265 $ hg tags
266 .hgtags@75d9f02dfe28, line 2: cannot parse entry
266 .hgtags@75d9f02dfe28, line 2: cannot parse entry
267 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
267 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
268 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
268 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
269 tip 8:c4be69a18c11
269 tip 8:c4be69a18c11
270 first 0:acb14030fe0a
270 first 0:acb14030fe0a
271 $ hg tip
271 $ hg tip
272 changeset: 8:c4be69a18c11
272 changeset: 8:c4be69a18c11
273 tag: tip
273 tag: tip
274 parent: 3:ac5e980c4dc0
274 parent: 3:ac5e980c4dc0
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: head
277 summary: head
278
278
279
279
280 Test tag precedence rules:
280 Test tag precedence rules:
281
281
282 $ cd ..
282 $ cd ..
283 $ hg init t2
283 $ hg init t2
284 $ cd t2
284 $ cd t2
285 $ echo foo > foo
285 $ echo foo > foo
286 $ hg add foo
286 $ hg add foo
287 $ hg ci -m 'add foo' # rev 0
287 $ hg ci -m 'add foo' # rev 0
288 $ hg tag bar # rev 1
288 $ hg tag bar # rev 1
289 $ echo >> foo
289 $ echo >> foo
290 $ hg ci -m 'change foo 1' # rev 2
290 $ hg ci -m 'change foo 1' # rev 2
291 $ hg up -C 1
291 $ hg up -C 1
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 $ hg tag -r 1 -f bar # rev 3
293 $ hg tag -r 1 -f bar # rev 3
294 $ hg up -C 1
294 $ hg up -C 1
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 $ echo >> foo
296 $ echo >> foo
297 $ hg ci -m 'change foo 2' # rev 4
297 $ hg ci -m 'change foo 2' # rev 4
298 created new head
298 created new head
299 $ hg tags
299 $ hg tags
300 tip 4:0c192d7d5e6b
300 tip 4:0c192d7d5e6b
301 bar 1:78391a272241
301 bar 1:78391a272241
302
302
303 Repeat in case of cache effects:
303 Repeat in case of cache effects:
304
304
305 $ hg tags
305 $ hg tags
306 tip 4:0c192d7d5e6b
306 tip 4:0c192d7d5e6b
307 bar 1:78391a272241
307 bar 1:78391a272241
308
308
309 Detailed dump of tag info:
309 Detailed dump of tag info:
310
310
311 $ hg heads -q # expect 4, 3, 2
311 $ hg heads -q # expect 4, 3, 2
312 4:0c192d7d5e6b
312 4:0c192d7d5e6b
313 3:6fa450212aeb
313 3:6fa450212aeb
314 2:7a94127795a3
314 2:7a94127795a3
315 $ dumptags 2
315 $ dumptags 2
316 rev 2: .hgtags:
316 rev 2: .hgtags:
317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
317 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
318 $ dumptags 3
318 $ dumptags 3
319 rev 3: .hgtags:
319 rev 3: .hgtags:
320 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
320 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
321 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
321 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
322 78391a272241d70354aa14c874552cad6b51bb42 bar
322 78391a272241d70354aa14c874552cad6b51bb42 bar
323 $ dumptags 4
323 $ dumptags 4
324 rev 4: .hgtags:
324 rev 4: .hgtags:
325 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
325 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
326
326
327 Dump cache:
327 Dump cache:
328
328
329 $ cat .hg/cache/tags2-visible
329 $ cat .hg/cache/tags2-visible
330 4 0c192d7d5e6b78a714de54a2e9627952a877e25a
330 4 0c192d7d5e6b78a714de54a2e9627952a877e25a
331 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
331 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
332 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
332 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
333 78391a272241d70354aa14c874552cad6b51bb42 bar
333 78391a272241d70354aa14c874552cad6b51bb42 bar
334
334
335 $ f --size --hexdump .hg/cache/hgtagsfnodes1
335 $ f --size --hexdump .hg/cache/hgtagsfnodes1
336 .hg/cache/hgtagsfnodes1: size=120
336 .hg/cache/hgtagsfnodes1: size=120
337 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
337 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
338 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
338 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
339 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
339 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
340 0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(|
340 0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(|
341 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.|
341 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.|
342 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..|
342 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..|
343 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(|
343 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(|
344 0070: 78 ee 5a 2d ad bc 94 3d |x.Z-...=|
344 0070: 78 ee 5a 2d ad bc 94 3d |x.Z-...=|
345
345
346 Corrupt the .hgtags fnodes cache
346 Corrupt the .hgtags fnodes cache
347 Extra junk data at the end should get overwritten on next cache update
347 Extra junk data at the end should get overwritten on next cache update
348
348
349 $ echo extra >> .hg/cache/hgtagsfnodes1
349 $ echo extra >> .hg/cache/hgtagsfnodes1
350 $ echo dummy1 > foo
350 $ echo dummy1 > foo
351 $ hg commit -m throwaway1
351 $ hg commit -m throwaway1
352
352
353 $ hg tags
353 $ hg tags
354 tip 5:8dbfe60eff30
354 tip 5:8dbfe60eff30
355 bar 1:78391a272241
355 bar 1:78391a272241
356
356
357 $ hg blackbox -l 6
357 $ hg blackbox -l 6
358 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags
358 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags
359 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing 24 bytes to cache/hgtagsfnodes1
359 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing 24 bytes to cache/hgtagsfnodes1
360 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> 2/3 cache hits/lookups in * seconds (glob)
360 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> 2/3 cache hits/lookups in * seconds (glob)
361 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing .hg/cache/tags2-visible with 1 tags
361 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> writing .hg/cache/tags2-visible with 1 tags
362 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
362 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> tags exited 0 after * seconds (glob)
363 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> blackbox -l 6
363 1970/01/01 00:00:00 bob @8dbfe60eff306a54259cfe007db9e330e7ecf866 (5000)> blackbox -l 6
364
364
365 #if unix-permissions no-root
365 #if unix-permissions no-root
366 Errors writing to .hgtags fnodes cache are silently ignored
366 Errors writing to .hgtags fnodes cache are silently ignored
367
367
368 $ echo dummy2 > foo
368 $ echo dummy2 > foo
369 $ hg commit -m throwaway2
369 $ hg commit -m throwaway2
370
370
371 $ chmod a-w .hg/cache/hgtagsfnodes1
371 $ chmod a-w .hg/cache/hgtagsfnodes1
372 $ rm -f .hg/cache/tags2-visible
372 $ rm -f .hg/cache/tags2-visible
373
373
374 $ hg tags
374 $ hg tags
375 tip 6:b968051b5cf3
375 tip 6:b968051b5cf3
376 bar 1:78391a272241
376 bar 1:78391a272241
377
377
378 $ hg blackbox -l 6
378 $ hg blackbox -l 6
379 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
379 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
380 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1'
380 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1'
381 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
381 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
382 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
382 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
383 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
383 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
384 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
384 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
385
385
386 $ chmod a+w .hg/cache/hgtagsfnodes1
386 $ chmod a+w .hg/cache/hgtagsfnodes1
387
387
388 $ rm -f .hg/cache/tags2-visible
388 $ rm -f .hg/cache/tags2-visible
389 $ hg tags
389 $ hg tags
390 tip 6:b968051b5cf3
390 tip 6:b968051b5cf3
391 bar 1:78391a272241
391 bar 1:78391a272241
392
392
393 $ hg blackbox -l 6
393 $ hg blackbox -l 6
394 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
394 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags
395 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing 24 bytes to cache/hgtagsfnodes1
395 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing 24 bytes to cache/hgtagsfnodes1
396 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
396 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> 2/3 cache hits/lookups in * seconds (glob)
397 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
397 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> writing .hg/cache/tags2-visible with 1 tags
398 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
398 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> tags exited 0 after * seconds (glob)
399 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
399 1970/01/01 00:00:00 bob @b968051b5cf3f624b771779c6d5f84f1d4c3fb5d (5000)> blackbox -l 6
400
400
401 $ f --size .hg/cache/hgtagsfnodes1
401 $ f --size .hg/cache/hgtagsfnodes1
402 .hg/cache/hgtagsfnodes1: size=168
402 .hg/cache/hgtagsfnodes1: size=168
403
403
404 $ hg -q --config extensions.strip= strip -r 6 --no-backup
404 $ hg -q --config extensions.strip= strip -r 6 --no-backup
405 #endif
405 #endif
406
406
407 Stripping doesn't truncate the tags cache until new data is available
407 Stripping doesn't truncate the tags cache until new data is available
408
408
409 $ rm -f .hg/cache/hgtagsfnodes1 .hg/cache/tags2-visible
409 $ rm -f .hg/cache/hgtagsfnodes1 .hg/cache/tags2-visible
410 $ hg tags
410 $ hg tags
411 tip 5:8dbfe60eff30
411 tip 5:8dbfe60eff30
412 bar 1:78391a272241
412 bar 1:78391a272241
413
413
414 $ f --size .hg/cache/hgtagsfnodes1
414 $ f --size .hg/cache/hgtagsfnodes1
415 .hg/cache/hgtagsfnodes1: size=144
415 .hg/cache/hgtagsfnodes1: size=144
416
416
417 $ hg -q --config extensions.strip= strip -r 5 --no-backup
417 $ hg -q --config extensions.strip= strip -r 5 --no-backup
418 $ hg tags
418 $ hg tags
419 tip 4:0c192d7d5e6b
419 tip 4:0c192d7d5e6b
420 bar 1:78391a272241
420 bar 1:78391a272241
421
421
422 $ hg blackbox -l 5
422 $ hg blackbox -l 5
423 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing 24 bytes to cache/hgtagsfnodes1
423 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing 24 bytes to cache/hgtagsfnodes1
424 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> 2/3 cache hits/lookups in * seconds (glob)
424 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> 2/3 cache hits/lookups in * seconds (glob)
425 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing .hg/cache/tags2-visible with 1 tags
425 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> writing .hg/cache/tags2-visible with 1 tags
426 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
426 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> tags exited 0 after * seconds (glob)
427 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> blackbox -l 5
427 1970/01/01 00:00:00 bob @0c192d7d5e6b78a714de54a2e9627952a877e25a (5000)> blackbox -l 5
428
428
429 $ f --size .hg/cache/hgtagsfnodes1
429 $ f --size .hg/cache/hgtagsfnodes1
430 .hg/cache/hgtagsfnodes1: size=120
430 .hg/cache/hgtagsfnodes1: size=120
431
431
432 $ echo dummy > foo
432 $ echo dummy > foo
433 $ hg commit -m throwaway3
433 $ hg commit -m throwaway3
434
434
435 $ hg tags
435 $ hg tags
436 tip 5:035f65efb448
436 tip 5:035f65efb448
437 bar 1:78391a272241
437 bar 1:78391a272241
438
438
439 $ hg blackbox -l 6
439 $ hg blackbox -l 6
440 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags
440 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags
441 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing 24 bytes to cache/hgtagsfnodes1
441 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing 24 bytes to cache/hgtagsfnodes1
442 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> 2/3 cache hits/lookups in * seconds (glob)
442 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> 2/3 cache hits/lookups in * seconds (glob)
443 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing .hg/cache/tags2-visible with 1 tags
443 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> writing .hg/cache/tags2-visible with 1 tags
444 1970/01/01 00:00:00 bob @(unknown) (5000)> tags exited 0 after * seconds (glob)
444 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> tags exited 0 after * seconds (glob)
445 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> blackbox -l 6
445 1970/01/01 00:00:00 bob @035f65efb448350f4772141702a81ab1df48c465 (5000)> blackbox -l 6
446 $ f --size .hg/cache/hgtagsfnodes1
446 $ f --size .hg/cache/hgtagsfnodes1
447 .hg/cache/hgtagsfnodes1: size=144
447 .hg/cache/hgtagsfnodes1: size=144
448
448
449 $ hg -q --config extensions.strip= strip -r 5 --no-backup
449 $ hg -q --config extensions.strip= strip -r 5 --no-backup
450
450
451 Test tag removal:
451 Test tag removal:
452
452
453 $ hg tag --remove bar # rev 5
453 $ hg tag --remove bar # rev 5
454 $ hg tip -vp
454 $ hg tip -vp
455 changeset: 5:5f6e8655b1c7
455 changeset: 5:5f6e8655b1c7
456 tag: tip
456 tag: tip
457 user: test
457 user: test
458 date: Thu Jan 01 00:00:00 1970 +0000
458 date: Thu Jan 01 00:00:00 1970 +0000
459 files: .hgtags
459 files: .hgtags
460 description:
460 description:
461 Removed tag bar
461 Removed tag bar
462
462
463
463
464 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
464 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
465 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
465 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
466 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
466 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
467 @@ -1,1 +1,3 @@
467 @@ -1,1 +1,3 @@
468 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
468 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
469 +78391a272241d70354aa14c874552cad6b51bb42 bar
469 +78391a272241d70354aa14c874552cad6b51bb42 bar
470 +0000000000000000000000000000000000000000 bar
470 +0000000000000000000000000000000000000000 bar
471
471
472 $ hg tags
472 $ hg tags
473 tip 5:5f6e8655b1c7
473 tip 5:5f6e8655b1c7
474 $ hg tags # again, try to expose cache bugs
474 $ hg tags # again, try to expose cache bugs
475 tip 5:5f6e8655b1c7
475 tip 5:5f6e8655b1c7
476
476
477 Remove nonexistent tag:
477 Remove nonexistent tag:
478
478
479 $ hg tag --remove foobar
479 $ hg tag --remove foobar
480 abort: tag 'foobar' does not exist
480 abort: tag 'foobar' does not exist
481 [255]
481 [255]
482 $ hg tip
482 $ hg tip
483 changeset: 5:5f6e8655b1c7
483 changeset: 5:5f6e8655b1c7
484 tag: tip
484 tag: tip
485 user: test
485 user: test
486 date: Thu Jan 01 00:00:00 1970 +0000
486 date: Thu Jan 01 00:00:00 1970 +0000
487 summary: Removed tag bar
487 summary: Removed tag bar
488
488
489
489
490 Undo a tag with rollback:
490 Undo a tag with rollback:
491
491
492 $ hg rollback # destroy rev 5 (restore bar)
492 $ hg rollback # destroy rev 5 (restore bar)
493 repository tip rolled back to revision 4 (undo commit)
493 repository tip rolled back to revision 4 (undo commit)
494 working directory now based on revision 4
494 working directory now based on revision 4
495 $ hg tags
495 $ hg tags
496 tip 4:0c192d7d5e6b
496 tip 4:0c192d7d5e6b
497 bar 1:78391a272241
497 bar 1:78391a272241
498 $ hg tags
498 $ hg tags
499 tip 4:0c192d7d5e6b
499 tip 4:0c192d7d5e6b
500 bar 1:78391a272241
500 bar 1:78391a272241
501
501
502 Test tag rank:
502 Test tag rank:
503
503
504 $ cd ..
504 $ cd ..
505 $ hg init t3
505 $ hg init t3
506 $ cd t3
506 $ cd t3
507 $ echo foo > foo
507 $ echo foo > foo
508 $ hg add foo
508 $ hg add foo
509 $ hg ci -m 'add foo' # rev 0
509 $ hg ci -m 'add foo' # rev 0
510 $ hg tag -f bar # rev 1 bar -> 0
510 $ hg tag -f bar # rev 1 bar -> 0
511 $ hg tag -f bar # rev 2 bar -> 1
511 $ hg tag -f bar # rev 2 bar -> 1
512 $ hg tag -fr 0 bar # rev 3 bar -> 0
512 $ hg tag -fr 0 bar # rev 3 bar -> 0
513 $ hg tag -fr 1 bar # rev 4 bar -> 1
513 $ hg tag -fr 1 bar # rev 4 bar -> 1
514 $ hg tag -fr 0 bar # rev 5 bar -> 0
514 $ hg tag -fr 0 bar # rev 5 bar -> 0
515 $ hg tags
515 $ hg tags
516 tip 5:85f05169d91d
516 tip 5:85f05169d91d
517 bar 0:bbd179dfa0a7
517 bar 0:bbd179dfa0a7
518 $ hg co 3
518 $ hg co 3
519 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
519 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 $ echo barbar > foo
520 $ echo barbar > foo
521 $ hg ci -m 'change foo' # rev 6
521 $ hg ci -m 'change foo' # rev 6
522 created new head
522 created new head
523 $ hg tags
523 $ hg tags
524 tip 6:735c3ca72986
524 tip 6:735c3ca72986
525 bar 0:bbd179dfa0a7
525 bar 0:bbd179dfa0a7
526
526
527 Don't allow moving tag without -f:
527 Don't allow moving tag without -f:
528
528
529 $ hg tag -r 3 bar
529 $ hg tag -r 3 bar
530 abort: tag 'bar' already exists (use -f to force)
530 abort: tag 'bar' already exists (use -f to force)
531 [255]
531 [255]
532 $ hg tags
532 $ hg tags
533 tip 6:735c3ca72986
533 tip 6:735c3ca72986
534 bar 0:bbd179dfa0a7
534 bar 0:bbd179dfa0a7
535
535
536 Strip 1: expose an old head:
536 Strip 1: expose an old head:
537
537
538 $ hg --config extensions.mq= strip 5
538 $ hg --config extensions.mq= strip 5
539 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
539 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
540 $ hg tags # partly stale cache
540 $ hg tags # partly stale cache
541 tip 5:735c3ca72986
541 tip 5:735c3ca72986
542 bar 1:78391a272241
542 bar 1:78391a272241
543 $ hg tags # up-to-date cache
543 $ hg tags # up-to-date cache
544 tip 5:735c3ca72986
544 tip 5:735c3ca72986
545 bar 1:78391a272241
545 bar 1:78391a272241
546
546
547 Strip 2: destroy whole branch, no old head exposed
547 Strip 2: destroy whole branch, no old head exposed
548
548
549 $ hg --config extensions.mq= strip 4
549 $ hg --config extensions.mq= strip 4
550 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
550 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
551 $ hg tags # partly stale
551 $ hg tags # partly stale
552 tip 4:735c3ca72986
552 tip 4:735c3ca72986
553 bar 0:bbd179dfa0a7
553 bar 0:bbd179dfa0a7
554 $ rm -f .hg/cache/tags2-visible
554 $ rm -f .hg/cache/tags2-visible
555 $ hg tags # cold cache
555 $ hg tags # cold cache
556 tip 4:735c3ca72986
556 tip 4:735c3ca72986
557 bar 0:bbd179dfa0a7
557 bar 0:bbd179dfa0a7
558
558
559 Test tag rank with 3 heads:
559 Test tag rank with 3 heads:
560
560
561 $ cd ..
561 $ cd ..
562 $ hg init t4
562 $ hg init t4
563 $ cd t4
563 $ cd t4
564 $ echo foo > foo
564 $ echo foo > foo
565 $ hg add
565 $ hg add
566 adding foo
566 adding foo
567 $ hg ci -m 'add foo' # rev 0
567 $ hg ci -m 'add foo' # rev 0
568 $ hg tag bar # rev 1 bar -> 0
568 $ hg tag bar # rev 1 bar -> 0
569 $ hg tag -f bar # rev 2 bar -> 1
569 $ hg tag -f bar # rev 2 bar -> 1
570 $ hg up -qC 0
570 $ hg up -qC 0
571 $ hg tag -fr 2 bar # rev 3 bar -> 2
571 $ hg tag -fr 2 bar # rev 3 bar -> 2
572 $ hg tags
572 $ hg tags
573 tip 3:197c21bbbf2c
573 tip 3:197c21bbbf2c
574 bar 2:6fa450212aeb
574 bar 2:6fa450212aeb
575 $ hg up -qC 0
575 $ hg up -qC 0
576 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
576 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
577
577
578 Bar should still point to rev 2:
578 Bar should still point to rev 2:
579
579
580 $ hg tags
580 $ hg tags
581 tip 4:3b4b14ed0202
581 tip 4:3b4b14ed0202
582 bar 2:6fa450212aeb
582 bar 2:6fa450212aeb
583
583
584 Test that removing global/local tags does not get confused when trying
584 Test that removing global/local tags does not get confused when trying
585 to remove a tag of type X which actually only exists as a type Y:
585 to remove a tag of type X which actually only exists as a type Y:
586
586
587 $ cd ..
587 $ cd ..
588 $ hg init t5
588 $ hg init t5
589 $ cd t5
589 $ cd t5
590 $ echo foo > foo
590 $ echo foo > foo
591 $ hg add
591 $ hg add
592 adding foo
592 adding foo
593 $ hg ci -m 'add foo' # rev 0
593 $ hg ci -m 'add foo' # rev 0
594
594
595 $ hg tag -r 0 -l localtag
595 $ hg tag -r 0 -l localtag
596 $ hg tag --remove localtag
596 $ hg tag --remove localtag
597 abort: tag 'localtag' is not a global tag
597 abort: tag 'localtag' is not a global tag
598 [255]
598 [255]
599 $
599 $
600 $ hg tag -r 0 globaltag
600 $ hg tag -r 0 globaltag
601 $ hg tag --remove -l globaltag
601 $ hg tag --remove -l globaltag
602 abort: tag 'globaltag' is not a local tag
602 abort: tag 'globaltag' is not a local tag
603 [255]
603 [255]
604 $ hg tags -v
604 $ hg tags -v
605 tip 1:a0b6fe111088
605 tip 1:a0b6fe111088
606 localtag 0:bbd179dfa0a7 local
606 localtag 0:bbd179dfa0a7 local
607 globaltag 0:bbd179dfa0a7
607 globaltag 0:bbd179dfa0a7
608
608
609 Test for issue3911
609 Test for issue3911
610
610
611 $ hg tag -r 0 -l localtag2
611 $ hg tag -r 0 -l localtag2
612 $ hg tag -l --remove localtag2
612 $ hg tag -l --remove localtag2
613 $ hg tags -v
613 $ hg tags -v
614 tip 1:a0b6fe111088
614 tip 1:a0b6fe111088
615 localtag 0:bbd179dfa0a7 local
615 localtag 0:bbd179dfa0a7 local
616 globaltag 0:bbd179dfa0a7
616 globaltag 0:bbd179dfa0a7
617
617
618 $ hg tag -r 1 -f localtag
618 $ hg tag -r 1 -f localtag
619 $ hg tags -v
619 $ hg tags -v
620 tip 2:5c70a037bb37
620 tip 2:5c70a037bb37
621 localtag 1:a0b6fe111088
621 localtag 1:a0b6fe111088
622 globaltag 0:bbd179dfa0a7
622 globaltag 0:bbd179dfa0a7
623
623
624 $ hg tags -v
624 $ hg tags -v
625 tip 2:5c70a037bb37
625 tip 2:5c70a037bb37
626 localtag 1:a0b6fe111088
626 localtag 1:a0b6fe111088
627 globaltag 0:bbd179dfa0a7
627 globaltag 0:bbd179dfa0a7
628
628
629 $ hg tag -r 1 localtag2
629 $ hg tag -r 1 localtag2
630 $ hg tags -v
630 $ hg tags -v
631 tip 3:bbfb8cd42be2
631 tip 3:bbfb8cd42be2
632 localtag2 1:a0b6fe111088
632 localtag2 1:a0b6fe111088
633 localtag 1:a0b6fe111088
633 localtag 1:a0b6fe111088
634 globaltag 0:bbd179dfa0a7
634 globaltag 0:bbd179dfa0a7
635
635
636 $ hg tags -v
636 $ hg tags -v
637 tip 3:bbfb8cd42be2
637 tip 3:bbfb8cd42be2
638 localtag2 1:a0b6fe111088
638 localtag2 1:a0b6fe111088
639 localtag 1:a0b6fe111088
639 localtag 1:a0b6fe111088
640 globaltag 0:bbd179dfa0a7
640 globaltag 0:bbd179dfa0a7
641
641
642 $ cd ..
642 $ cd ..
643
643
644 Create a repository with tags data to test .hgtags fnodes transfer
644 Create a repository with tags data to test .hgtags fnodes transfer
645
645
646 $ hg init tagsserver
646 $ hg init tagsserver
647 $ cd tagsserver
647 $ cd tagsserver
648 $ cat > .hg/hgrc << EOF
648 $ cat > .hg/hgrc << EOF
649 > [experimental]
649 > [experimental]
650 > bundle2-exp=True
650 > bundle2-exp=True
651 > EOF
651 > EOF
652 $ touch foo
652 $ touch foo
653 $ hg -q commit -A -m initial
653 $ hg -q commit -A -m initial
654 $ hg tag -m 'tag 0.1' 0.1
654 $ hg tag -m 'tag 0.1' 0.1
655 $ echo second > foo
655 $ echo second > foo
656 $ hg commit -m second
656 $ hg commit -m second
657 $ hg tag -m 'tag 0.2' 0.2
657 $ hg tag -m 'tag 0.2' 0.2
658 $ hg tags
658 $ hg tags
659 tip 3:40f0358cb314
659 tip 3:40f0358cb314
660 0.2 2:f63cc8fe54e4
660 0.2 2:f63cc8fe54e4
661 0.1 0:96ee1d7354c4
661 0.1 0:96ee1d7354c4
662 $ cd ..
662 $ cd ..
663
663
664 Cloning should pull down hgtags fnodes mappings and write the cache file
664 Cloning should pull down hgtags fnodes mappings and write the cache file
665
665
666 $ hg --config experimental.bundle2-exp=True clone --pull tagsserver tagsclient
666 $ hg --config experimental.bundle2-exp=True clone --pull tagsserver tagsclient
667 requesting all changes
667 requesting all changes
668 adding changesets
668 adding changesets
669 adding manifests
669 adding manifests
670 adding file changes
670 adding file changes
671 added 4 changesets with 4 changes to 2 files
671 added 4 changesets with 4 changes to 2 files
672 updating to branch default
672 updating to branch default
673 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
673 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
674
674
675 Missing tags2* files means the cache wasn't written through the normal mechanism.
675 Missing tags2* files means the cache wasn't written through the normal mechanism.
676
676
677 $ ls tagsclient/.hg/cache
677 $ ls tagsclient/.hg/cache
678 branch2-served
678 branch2-served
679 hgtagsfnodes1
679 hgtagsfnodes1
680 rbc-names-v1
680 rbc-names-v1
681 rbc-revs-v1
681 rbc-revs-v1
682
682
683 Cache should contain the head only, even though other nodes have tags data
683 Cache should contain the head only, even though other nodes have tags data
684
684
685 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
685 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
686 tagsclient/.hg/cache/hgtagsfnodes1: size=96
686 tagsclient/.hg/cache/hgtagsfnodes1: size=96
687 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
687 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
688 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
688 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
689 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
689 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
690 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
690 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
691 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
691 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
692 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
692 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
693
693
694 Running hg tags should produce tags2* file and not change cache
694 Running hg tags should produce tags2* file and not change cache
695
695
696 $ hg -R tagsclient tags
696 $ hg -R tagsclient tags
697 tip 3:40f0358cb314
697 tip 3:40f0358cb314
698 0.2 2:f63cc8fe54e4
698 0.2 2:f63cc8fe54e4
699 0.1 0:96ee1d7354c4
699 0.1 0:96ee1d7354c4
700
700
701 $ ls tagsclient/.hg/cache
701 $ ls tagsclient/.hg/cache
702 branch2-served
702 branch2-served
703 hgtagsfnodes1
703 hgtagsfnodes1
704 rbc-names-v1
704 rbc-names-v1
705 rbc-revs-v1
705 rbc-revs-v1
706 tags2-visible
706 tags2-visible
707
707
708 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
708 $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1
709 tagsclient/.hg/cache/hgtagsfnodes1: size=96
709 tagsclient/.hg/cache/hgtagsfnodes1: size=96
710 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
710 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
711 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
711 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
712 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
712 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
713 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
713 0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
714 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
714 0040: ff ff ff ff ff ff ff ff 40 f0 35 8c 19 e0 a7 d3 |........@.5.....|
715 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
715 0050: 8a 5c 6a 82 4d cf fb a5 87 d0 2f a3 1e 4f 2f 8a |.\j.M...../..O/.|
716
716
General Comments 0
You need to be logged in to leave comments. Login now