tags: introduce _readtaghist function
The existing _readtags function has been modified a little and renamed
_readtaghist. A new _readtaghist function has been added, which is a wrappger
around _readtaghist. Its output is the same as the old _readtaghist.
The purpose of this change is to make it possible to automatically merge tag
files. In order to do so we will need to get the line numbers for each of the
tag-node pairs on the first merge parent.
This is not used yet, but will be used on a follow up patch that will introduce
an automatic tag merge algorithm.
I performed some tests to compare the effect of this change. I used timeit to
run the test-tags.t test a 9 times with and without this patch. The results
were:
- without this patch: 3 loops, best of 3: 8.55 sec per loop
- with this patch: 3 loops, best of 3: 8.49 sec per loop
The the test was on average was slightly faster with this patch (although the
difference was probably not statistically significant).
$ "$TESTDIR/hghave" serve || exit 80
#if windows
$ hg clone http://localhost:$HGPORT/ copy
abort: * (glob)
[255]
#else
$ hg clone http://localhost:$HGPORT/ copy
abort: error: Connection refused
[255]
#endif
$ test -d copy
[1]
$ cat > dumb.py <<EOF
> import BaseHTTPServer, SimpleHTTPServer, os, signal
> def run(server_class=BaseHTTPServer.HTTPServer,
> handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
> server_address = ('localhost', int(os.environ['HGPORT']))
> httpd = server_class(server_address, handler_class)
> open("listening", "w")
> httpd.handle_request()
> run()
> EOF
$ python dumb.py 2> log &
$ P=$!
$ while [ ! -f listening ]; do sleep 0; done
$ hg clone http://localhost:$HGPORT/foo copy2
abort: HTTP Error 404: * (glob)
[255]
$ wait $P