Merge with TAH
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Merge with TAH
manifest hash: ec82cc2d7b7357fd7db4917e09d7d6865482de58
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCr+f1ywK+sNU5EO8RAuPtAJ0WilDBo3iG4S/dmIabhzYW987TtgCgkjkM
8OmatsrjG01iJAhkKJj+XnQ=
=mOLr
-----END PGP SIGNATURE-----
--- a/mercurial/commands.py Wed Jun 15 08:32:29 2005 +0100
+++ b/mercurial/commands.py Wed Jun 15 00:33:57 2005 -0800
@@ -126,18 +126,6 @@
ui.status("summary: %s\n" % description.splitlines()[0])
ui.status("\n")
-def tags_load(repo):
- repo.lookup(0) # prime the cache
- i = repo.tags.items()
- n = []
- for e in i:
- try:
- l = repo.changelog.rev(e[1])
- except KeyError:
- l = -2
- n.append((l, e))
- return n
-
def help(ui, cmd=None):
'''show help for a given command or all commands'''
if cmd:
@@ -328,17 +316,15 @@
"""print information about the working copy"""
(c, a, d, u) = repo.diffdir(repo.root)
mflag = (c or a or d or u) and "+" or ""
- parents = [parent for parent in repo.dirstate.parents()
- if parent != hg.nullid]
+ parents = [p for p in repo.dirstate.parents() if p != hg.nullid]
if not parents:
- ui.note("unknown\n")
+ ui.write("unknown\n")
return
tstring = ''
if not ui.quiet:
- taglist = [e[1] for e in tags_load(repo)]
- tstring = " %s" % ' + '.join([e[0] for e in taglist
- if e[0] != 'tip' and e[1] in parents])
+ tags = sum(map(repo.nodetags, parents), [])
+ tstring = " " + ' + '.join(tags)
hexfunc = ui.verbose and hg.hex or hg.short
pstring = '+'.join([hexfunc(parent) for parent in parents])
@@ -544,17 +530,15 @@
def tags(ui, repo):
"""list repository tags"""
- n = tags_load(repo)
-
- n.sort()
- n.reverse()
- i = [ e[1] for e in n ]
- for k, n in i:
+
+ l = repo.tagslist()
+ l.reverse()
+ for t,n in l:
try:
r = repo.changelog.rev(n)
except KeyError:
r = "?"
- print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n))
+ print "%-30s %5d:%s" % (t, repo.changelog.rev(n), hg.hex(n))
def tip(ui, repo):
"""show the tip revision"""
--- a/mercurial/hg.py Wed Jun 15 08:32:29 2005 +0100
+++ b/mercurial/hg.py Wed Jun 15 00:33:57 2005 -0800
@@ -334,7 +334,8 @@
self.manifest = manifest(self.opener)
self.changelog = changelog(self.opener)
self.ignorelist = None
- self.tags = None
+ self.tagscache = None
+ self.nodetagscache = None
if not self.remote:
self.dirstate = dirstate(self.opener, ui, self.root)
@@ -355,9 +356,10 @@
if pat.search(f): return True
return False
- def lookup(self, key):
- if self.tags is None:
- self.tags = {}
+ def tags(self):
+ '''return a mapping of tag to node'''
+ if not self.tagscache:
+ self.tagscache = {}
try:
# read each head of the tags file, ending with the tip
# and add each tag found to the map, with "newer" ones
@@ -369,11 +371,35 @@
for l in fl.revision(r).splitlines():
if l:
n, k = l.split(" ")
- self.tags[k] = bin(n)
+ self.tagscache[k] = bin(n)
except KeyError: pass
- self.tags['tip'] = self.changelog.tip()
+ self.tagscache['tip'] = self.changelog.tip()
+
+ return self.tagscache
+
+ def tagslist(self):
+ '''return a list of tags ordered by revision'''
+ l = []
+ for t,n in self.tags().items():
+ try:
+ r = self.changelog.rev(n)
+ except:
+ r = -2 # sort to the beginning of the list if unknown
+ l.append((r,t,n))
+ l.sort()
+ return [(t,n) for r,t,n in l]
+
+ def nodetags(self, node):
+ '''return the tags associated with a node'''
+ if not self.nodetagscache:
+ self.nodetagscache = {}
+ for t,n in self.tags().items():
+ self.nodetagscache.setdefault(n,[]).append(t)
+ return self.nodetagscache.get(node, [])
+
+ def lookup(self, key):
try:
- return self.tags[key]
+ return self.tags()[key]
except KeyError:
return self.changelog.lookup(key)
@@ -998,8 +1024,7 @@
remove.append(f) # other deleted it
else:
if n == m1.get(f, nullid): # same as parent
- self.ui.debug("remote deleted %s\n" % f)
- remove.append(f)
+ self.ui.debug("local created %s, keeping\n" % f)
else:
self.ui.debug("working dir created %s, keeping\n" % f)
@@ -1093,8 +1118,8 @@
fl = self.file(fn)
base = fl.ancestor(my, other)
a = self.wjoin(fn)
- b = temp("other", other)
- c = temp("base", base)
+ b = temp("base", base)
+ c = temp("other", other)
self.ui.note("resolving %s\n" % fn)
self.ui.debug("file %s: other %s ancestor %s\n" %
--- a/mercurial/hgweb.py Wed Jun 15 08:32:29 2005 +0100
+++ b/mercurial/hgweb.py Wed Jun 15 00:33:57 2005 -0800
@@ -523,12 +523,8 @@
cl = self.repo.changelog
mf = cl.read(cl.tip())[0]
- self.repo.lookup(0) # prime the cache
- i = self.repo.tags.items()
- n = [ (cl.rev(e[1]), e) for e in i ] # sort by revision
- n.sort()
- n.reverse()
- i = [ e[1] for e in n ]
+ i = self.repo.tagslist()
+ i.reverse()
def entries():
parity = 0
--- a/tests/run-tests Wed Jun 15 08:32:29 2005 +0100
+++ b/tests/run-tests Wed Jun 15 00:33:57 2005 -0800
@@ -28,6 +28,7 @@
echo $f output changed:
diff -u $H/$f.out .out && true
cp .out $H/$f.err
+ fail=1
fi
cd $H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-conflict Wed Jun 15 00:33:57 2005 -0800
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -x
+hg init
+echo "nothing" > a
+hg add a
+hg commit -t ancestor -u test -d "0 0"
+echo "something" > a
+hg commit -t branch1 -u test -d "0 0"
+hg co 0
+echo "something else" > a
+hg commit -t branch2 -u test -d "0 0"
+export HGMERGE=merge
+hg -d up -m 1
+hg id
+cat a | grep -v ">>>" | grep -v "<<<"
+hg status
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-conflict.out Wed Jun 15 00:33:57 2005 -0800
@@ -0,0 +1,32 @@
++ hg init
++ echo nothing
++ hg add a
++ hg commit -t ancestor -u test -d '0 0'
++ echo something
++ hg commit -t branch1 -u test -d '0 0'
++ hg co 0
++ echo 'something else'
++ hg commit -t branch2 -u test -d '0 0'
++ export HGMERGE=merge
++ HGMERGE=merge
++ hg -d up -m 1
+merge: warning: conflicts during merge
+resolving manifests
+ ancestor 1c6e5a12 local 35fedfab remote a5801785
+ a versions differ, resolve
+working dir created .out, keeping
+merging a
+resolving a
+file a: other d7250518 ancestor 68ba9db7
+merging a failed!
++ hg id
+32e80765+75234512+ tip
++ cat a
++ grep -v '>>>'
++ grep -v '<<<'
+something else
+=======
+something
++ hg status
+C a
+? .out
--- a/tests/test-help.out Wed Jun 15 08:32:29 2005 +0100
+++ b/tests/test-help.out Wed Jun 15 00:33:57 2005 -0800
@@ -12,6 +12,7 @@
heads show current repository heads
help show help for a given command or all commands
history show the changelog history
+ identify print information about the working copy
init create a new repository or copy an existing one
log show the revision history of a single file
manifest output the latest or given revision of the project manifest
@@ -58,6 +59,7 @@
heads show current repository heads
help show help for a given command or all commands
history show the changelog history
+ identify print information about the working copy
init create a new repository or copy an existing one
log show the revision history of a single file
manifest output the latest or given revision of the project manifest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-tags Wed Jun 15 00:33:57 2005 -0800
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -x
+mkdir t
+cd t
+hg init
+hg id
+echo a > a
+hg add a
+hg commit -t "test" -u test -d "0 0"
+hg co
+hg identify
+T=`hg -q tip | cut -d : -f 2`
+echo "$T first" > .hgtags
+cat .hgtags
+hg add .hgtags
+hg commit -t "add tags" -u test -d "0 0"
+hg tags
+hg identify
+echo bb > a
+hg status
+hg identify
+hg co first
+hg id
+hg -v id
+hg status
+echo 1 > b
+hg add b
+hg commit -t "branch" -u test -d "0 0"
+hg id
+hg co -m 1
+hg id
+hg status
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-tags.out Wed Jun 15 00:33:57 2005 -0800
@@ -0,0 +1,47 @@
++ mkdir t
++ cd t
++ hg init
++ hg id
+unknown
++ echo a
++ hg add a
++ hg commit -t test -u test -d '0 0'
++ hg co
++ hg identify
+acb14030 tip
+++ hg -q tip
+++ cut -d : -f 2
++ T=acb14030fe0a21b60322c440ad2d20cf7685a376
++ echo 'acb14030fe0a21b60322c440ad2d20cf7685a376 first'
++ cat .hgtags
+acb14030fe0a21b60322c440ad2d20cf7685a376 first
++ hg add .hgtags
++ hg commit -t 'add tags' -u test -d '0 0'
++ hg tags
+tip 1:b9154636be938d3d431e75a7c906504a079bfe07
+first 0:acb14030fe0a21b60322c440ad2d20cf7685a376
++ hg identify
+b9154636 tip
++ echo bb
++ hg status
+C a
++ hg identify
+b9154636+ tip
++ hg co first
++ hg id
+acb14030+ first
++ hg -v id
+acb14030fe0a21b60322c440ad2d20cf7685a376+ first
++ hg status
+C a
++ echo 1
++ hg add b
++ hg commit -t branch -u test -d '0 0'
++ hg id
+c8edf041 tip
++ hg co -m 1
++ hg id
+c8edf041+b9154636+ tip
++ hg status
+C a
+C .hgtags