--- a/hgext/win32text.py Fri Mar 14 21:35:49 2008 +0100
+++ b/hgext/win32text.py Fri Mar 14 21:36:09 2008 +0100
@@ -22,6 +22,7 @@
# [hooks]
# pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
+from mercurial import util
from mercurial.i18n import gettext as _
from mercurial.node import bin, short
import re
@@ -46,19 +47,15 @@
def dumbencode(s, cmd):
return s.replace('\r\n', '\n')
-def clevertest(s, cmd):
- if '\0' in s: return False
- return True
-
def cleverdecode(s, cmd, **kwargs):
- if clevertest(s, cmd):
- return dumbdecode(s, cmd, **kwargs)
- return s
+ if util.binary(s):
+ return s
+ return dumbdecode(s, cmd, **kwargs)
def cleverencode(s, cmd):
- if clevertest(s, cmd):
- return dumbencode(s, cmd)
- return s
+ if util.binary(s):
+ return s
+ return dumbencode(s, cmd)
_filters = {
'dumbdecode:': dumbdecode,
@@ -75,7 +72,7 @@
if f not in c:
continue
data = c[f].data()
- if '\0' not in data and '\r\n' in data:
+ if not util.binary(data) and '\r\n' in data:
if not halt:
ui.warn(_('Attempt to commit or push text file(s) '
'using CRLF line endings\n'))
--- a/mercurial/cmdutil.py Fri Mar 14 21:35:49 2008 +0100
+++ b/mercurial/cmdutil.py Fri Mar 14 21:36:09 2008 +0100
@@ -470,7 +470,7 @@
if len(pats) == 1:
raise util.Abort(_('no destination specified'))
dest = pats.pop()
- destdirexists = os.path.isdir(dest)
+ destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
if not destdirexists:
if len(pats) > 1 or util.patkind(pats[0], None)[0]:
raise util.Abort(_('with multiple sources, destination must be an '
--- a/mercurial/commands.py Fri Mar 14 21:35:49 2008 +0100
+++ b/mercurial/commands.py Fri Mar 14 21:36:09 2008 +0100
@@ -574,15 +574,17 @@
if len(args) == 3:
index, rev1, rev2 = args
r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
+ lookup = r.lookup
elif len(args) == 2:
if not repo:
raise util.Abort(_("There is no Mercurial repository here "
"(.hg not found)"))
rev1, rev2 = args
r = repo.changelog
+ lookup = repo.lookup
else:
raise util.Abort(_('either two or three arguments required'))
- a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
+ a = r.ancestor(lookup(rev1), lookup(rev2))
ui.write("%d:%s\n" % (r.rev(a), hex(a)))
def debugcomplete(ui, cmd='', **opts):
--- a/mercurial/dirstate.py Fri Mar 14 21:35:49 2008 +0100
+++ b/mercurial/dirstate.py Fri Mar 14 21:36:09 2008 +0100
@@ -63,6 +63,9 @@
elif name == '_slash':
self._slash = self._ui.configbool('ui', 'slash') and os.sep != '/'
return self._slash
+ elif name == '_checkexec':
+ self._checkexec = util.checkexec(self._root)
+ return self._checkexec
else:
raise AttributeError, name
@@ -578,8 +581,9 @@
if type_ == 'n':
if not st:
st = lstat(_join(fn))
- if (size >= 0 and (size != st.st_size
- or (mode ^ st.st_mode) & 0100)
+ if (size >= 0 and
+ (size != st.st_size
+ or ((mode ^ st.st_mode) & 0100 and self._checkexec))
or size == -2
or fn in self._copymap):
madd(fn)
--- a/mercurial/hgweb/hgweb_mod.py Fri Mar 14 21:35:49 2008 +0100
+++ b/mercurial/hgweb/hgweb_mod.py Fri Mar 14 21:36:09 2008 +0100
@@ -367,6 +367,20 @@
branches.append({"name": branch})
return branches
+ def nodeinbranch(self, ctx):
+ branches = []
+ branch = ctx.branch()
+ if branch != 'default' and self.repo.branchtags().get(branch) != ctx.node():
+ branches.append({"name": branch})
+ return branches
+
+ def nodebranchnodefault(self, ctx):
+ branches = []
+ branch = ctx.branch()
+ if branch != 'default':
+ branches.append({"name": branch})
+ return branches
+
def showtag(self, tmpl, t1, node=nullid, **args):
for t in self.repo.nodetags(node):
yield tmpl(t1, tag=t, **args)
@@ -458,6 +472,7 @@
"rev": i,
"node": hex(n),
"tags": self.nodetagsdict(n),
+ "inbranch": self.nodeinbranch(ctx),
"branches": self.nodebranchdict(ctx)})
if limit > 0:
@@ -529,6 +544,7 @@
rev=ctx.rev(),
node=hex(n),
tags=self.nodetagsdict(n),
+ inbranch=self.nodeinbranch(ctx),
branches=self.nodebranchdict(ctx))
if count >= self.maxchanges:
@@ -572,6 +588,8 @@
files=files,
archives=self.archivelist(hex(n)),
tags=self.nodetagsdict(n),
+ branch=self.nodebranchnodefault(ctx),
+ inbranch=self.nodeinbranch(ctx),
branches=self.nodebranchdict(ctx))
def filelog(self, tmpl, fctx):
@@ -642,6 +660,7 @@
author=fctx.user(),
date=fctx.date(),
desc=fctx.description(),
+ branch=self.nodebranchnodefault(fctx),
parent=self.siblings(fctx.parents()),
child=self.siblings(fctx.children()),
rename=self.renamelink(fl, n),
@@ -689,6 +708,7 @@
date=fctx.date(),
desc=fctx.description(),
rename=self.renamelink(fl, n),
+ branch=self.nodebranchnodefault(fctx),
parent=self.siblings(fctx.parents()),
child=self.siblings(fctx.children()),
permissions=fctx.manifest().flags(f))
@@ -757,6 +777,7 @@
dentries=dirlist,
archives=self.archivelist(hex(node)),
tags=self.nodetagsdict(node),
+ inbranch=self.nodeinbranch(ctx),
branches=self.nodebranchdict(ctx))
def tags(self, tmpl):
@@ -837,6 +858,7 @@
rev=i,
node=hn,
tags=self.nodetagsdict(n),
+ inbranch=self.nodeinbranch(ctx),
branches=self.nodebranchdict(ctx)))
yield l
@@ -869,6 +891,7 @@
file=path,
node=hex(n),
rev=fctx.rev(),
+ branch=self.nodebranchnodefault(fctx),
parent=self.siblings(parents),
child=self.siblings(fctx.children()),
diff=diff)
--- a/mercurial/localrepo.py Fri Mar 14 21:35:49 2008 +0100
+++ b/mercurial/localrepo.py Fri Mar 14 21:36:09 2008 +0100
@@ -883,13 +883,12 @@
if branchname:
extra["branch"] = branchname
- if use_dirstate:
- lines = [line.rstrip() for line in text.rstrip().splitlines()]
- while lines and not lines[0]:
- del lines[0]
- if not lines:
- raise util.Abort(_("empty commit message"))
- text = '\n'.join(lines)
+ lines = [line.rstrip() for line in text.rstrip().splitlines()]
+ while lines and not lines[0]:
+ del lines[0]
+ if not lines and use_dirstate:
+ raise util.Abort(_("empty commit message"))
+ text = '\n'.join(lines)
n = self.changelog.add(mn, changed + removed, text, trp, p1, p2,
user, date, extra)
--- a/mercurial/merge.py Fri Mar 14 21:35:49 2008 +0100
+++ b/mercurial/merge.py Fri Mar 14 21:36:09 2008 +0100
@@ -609,7 +609,7 @@
raise util.Abort(_("update spans branches, use 'hg merge' "
"or 'hg update -C' to lose changes"))
if branchmerge and not forcemerge:
- if wc.files():
+ if wc.files() or wc.deleted():
raise util.Abort(_("outstanding uncommitted changes"))
### calculate phase
--- a/setup.py Fri Mar 14 21:35:49 2008 +0100
+++ b/setup.py Fri Mar 14 21:36:09 2008 +0100
@@ -10,13 +10,36 @@
raise SystemExit, "Mercurial requires python 2.3 or later."
import os
+import shutil
+import tempfile
from distutils.core import setup, Extension
from distutils.command.install_data import install_data
+from distutils.ccompiler import new_compiler
import mercurial.version
extra = {}
+# simplified version of distutils.ccompiler.CCompiler.has_function
+# that actually removes its temporary files.
+def has_function(cc, funcname):
+ tmpdir = tempfile.mkdtemp(prefix='hg-install-')
+ try:
+ fname = os.path.join(tmpdir, 'funcname.c')
+ f = open(fname, 'w')
+ f.write('int main(void) {\n')
+ f.write(' %s();\n' % funcname)
+ f.write('}\n')
+ f.close()
+ try:
+ objects = cc.compile([fname])
+ cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
+ except:
+ return False
+ return True
+ finally:
+ shutil.rmtree(tmpdir)
+
# py2exe needs to be installed to work
try:
import py2exe
@@ -66,10 +89,13 @@
ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
if sys.platform == 'linux2' and os.uname()[2] > '2.6':
- # the inotify extension is only usable with Linux 2.6 kernels
- ext_modules.append(Extension('hgext.inotify.linux._inotify',
- ['hgext/inotify/linux/_inotify.c']))
- packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
+ # The inotify extension is only usable with Linux 2.6 kernels.
+ # You also need a reasonably recent C library.
+ cc = new_compiler()
+ if has_function(cc, 'inotify_add_watch'):
+ ext_modules.append(Extension('hgext.inotify.linux._inotify',
+ ['hgext/inotify/linux/_inotify.c']))
+ packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
except ImportError:
pass
--- a/templates/gitweb/changelogentry.tmpl Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/changelogentry.tmpl Fri Mar 14 21:36:09 2008 +0100
@@ -1,5 +1,5 @@
<div>
-<a class="title" href="{url}rev/#node|short#{sessionvars%urlparameter}"><span class="age">#date|age# ago</span>#desc|strip|firstline|escape#<span class="logtags"> {branches%branchtag}{tags%tagtag}</span></a>
+<a class="title" href="{url}rev/#node|short#{sessionvars%urlparameter}"><span class="age">#date|age# ago</span>#desc|strip|firstline|escape#<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a>
</div>
<div class="title_text">
<div class="log_link">
--- a/templates/gitweb/changeset.tmpl Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/changeset.tmpl Fri Mar 14 21:36:09 2008 +0100
@@ -16,12 +16,13 @@
</div>
<div>
-<a class="title" href="{url}raw-rev/#node|short#">#desc|strip|escape|firstline# <span class="logtags">{branches%branchtag}{tags%tagtag}</span></a>
+<a class="title" href="{url}raw-rev/#node|short#">#desc|strip|escape|firstline# <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a>
</div>
<div class="title_text">
<table cellspacing="0">
<tr><td>author</td><td>#author|obfuscate#</td></tr>
<tr><td></td><td>#date|date# (#date|age# ago)</td></tr>
+#branch%changesetbranch#
<tr><td>changeset {rev}</td><td style="font-family:monospace">{node|short}</td></tr>
#parent%changesetparent#
#child%changesetchild#
--- a/templates/gitweb/fileannotate.tmpl Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/fileannotate.tmpl Fri Mar 14 21:36:09 2008 +0100
@@ -35,6 +35,7 @@
<tr>
<td></td>
<td>#date|date# (#date|age# ago)</td></tr>
+#branch%filerevbranch#
<tr>
<td>changeset {rev}</td>
<td style="font-family:monospace"><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}">#node|short#</a></td></tr>
--- a/templates/gitweb/filediff.tmpl Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/filediff.tmpl Fri Mar 14 21:36:09 2008 +0100
@@ -28,6 +28,7 @@
<div class="title">{file|escape}</div>
<table>
+{branch%filerevbranch}
<tr>
<td>changeset {rev}</td>
<td style="font-family:monospace"><a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>
--- a/templates/gitweb/filerevision.tmpl Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/filerevision.tmpl Fri Mar 14 21:36:09 2008 +0100
@@ -35,6 +35,7 @@
<tr>
<td></td>
<td>#date|date# (#date|age# ago)</td></tr>
+#branch%filerevbranch#
<tr>
<td>changeset {rev}</td>
<td style="font-family:monospace"><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}">#node|short#</a></td></tr>
--- a/templates/gitweb/manifest.tmpl Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/manifest.tmpl Fri Mar 14 21:36:09 2008 +0100
@@ -20,7 +20,7 @@
<a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> #archives%archiveentry#<br/>
</div>
-<div class="title">#path|escape# <span class="logtags">{branches%branchtag}{tags%tagtag}</span></div>
+<div class="title">#path|escape# <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></div>
<table cellspacing="0">
<tr class="parity#upparity#">
<td style="font-family:monospace">drwxr-xr-x</td>
--- a/templates/gitweb/map Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/gitweb/map Fri Mar 14 21:36:09 2008 +0100
@@ -30,7 +30,9 @@
difflineat = '<span style="color:#990099;"><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
diffline = '<span><a class="linenr" href="##lineid#" id="#lineid#">#linenumber#</a> #line|escape#</span>'
changelogparent = '<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="#url#rev/#node|short#{sessionvars%urlparameter}">#node|short#</a></td></tr>'
+changesetbranch = '<tr><td>branch</td><td>{name}</td></tr>'
changesetparent = '<tr><td>parent {rev}</td><td style="font-family:monospace"><a class="list" href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
+filerevbranch = '<tr><td>branch</td><td>{name}</td></tr>'
filerevparent = '<tr><td>parent {rev}</td><td style="font-family:monospace"><a class="list" href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{rename%filerename}{node|short}</a></td></tr>'
filerename = '{file|escape}@'
filelogrename = '| <a href="{url}file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">base</a>'
@@ -50,7 +52,8 @@
shortlog = shortlog.tmpl
tagtag = '<span class="tagtag" title="{name}">{name}</span> '
branchtag = '<span class="branchtag" title="{name}">{name}</span> '
-shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author|person#</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b> <span class="logtags">{branches%branchtag}{tags%tagtag}</span></a></td><td class="link" nowrap><a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> | <a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a></td></tr>'
+inbranchtag = '<span class="inbranchtag" title="{name}">{name}</span> '
+shortlogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><i>#author|person#</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b> <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></td><td class="link" nowrap><a href="{url}rev/#node|short#{sessionvars%urlparameter}">changeset</a> | <a href="{url}file/#node|short#{sessionvars%urlparameter}">files</a></td></tr>'
filelogentry = '<tr class="parity#parity#"><td class="age"><i>#date|age# ago</i></td><td><a class="list" href="{url}rev/#node|short#{sessionvars%urlparameter}"><b>#desc|strip|firstline|escape#</b></a></td><td class="link"><a href="{url}file/#node|short#/#file|urlescape#{sessionvars%urlparameter}">file</a> | <a href="{url}diff/#node|short#/#file|urlescape#{sessionvars%urlparameter}">diff</a> | <a href="{url}annotate/#node|short#/#file|urlescape#{sessionvars%urlparameter}">annotate</a> #rename%filelogrename#</td></tr>'
archiveentry = ' | <a href="{url}archive/{node|short}{extension}">#type|escape#</a> '
indexentry = '<tr class="parity{parity}"><td><a class="list" href="{url}{sessionvars%urlparameter}"><b>{name|escape}</b></a></td><td>{description}</td><td>{contact|obfuscate}</td><td class="age">{lastchange|age} ago</td><td class="indexlinks">{archives%indexarchiveentry}</td><td><div class="rss_logo"><a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a></div></td></tr>\n'
--- a/templates/static/style-gitweb.css Fri Mar 14 21:35:49 2008 +0100
+++ b/templates/static/style-gitweb.css Fri Mar 14 21:36:09 2008 +0100
@@ -75,3 +75,7 @@
background-color: #aaffaa;
border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
}
+span.logtags span.inbranchtag {
+ background-color: #d5dde6;
+ border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4;
+}
--- a/tests/test-convert-git.out Fri Mar 14 21:35:49 2008 +0100
+++ b/tests/test-convert-git.out Fri Mar 14 21:36:09 2008 +0100
@@ -10,10 +10,10 @@
2 t4.1
1 t4.2
0 Merge branch other
-changeset: 5:c6d72c98aa00
+changeset: 5:4ab1af49a271
tag: tip
-parent: 3:a18bdfccf429
-parent: 4:48cb5b72ce56
+parent: 3:0222ab0998d7
+parent: 4:5333c870e3c2
user: test <test@example.org>
date: Mon Jan 01 00:00:15 2007 +0000
files: a
--- a/tests/test-fetch Fri Mar 14 21:35:49 2008 +0100
+++ b/tests/test-fetch Fri Mar 14 21:36:09 2008 +0100
@@ -1,5 +1,9 @@
#!/bin/sh
+# adjust to non-default HGPORT, e.g. with run-tests.py -j
+hideport() { sed "s/localhost:$HGPORT/localhost:20059/"; }
+hidehash() { sed "s/changeset 3:............ merges/changeset 3:... merges/"; }
+
echo "[extensions]" >> $HGRCPATH
echo "fetch=" >> $HGRCPATH
@@ -36,12 +40,12 @@
cat a/hg.pid >> "$DAEMON_PIDS"
echo '% fetch over http, no auth'
-hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/
-hg --cwd d tip --template '{desc}\n'
+hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/ | hideport | hidehash
+hg --cwd d tip --template '{desc}\n' | hideport
echo '% fetch over http with auth (should be hidden in desc)'
-hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/
-hg --cwd e tip --template '{desc}\n'
+hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/ | hideport | hidehash
+hg --cwd e tip --template '{desc}\n' | hideport
hg clone a f
hg clone a g
--- a/tests/test-fetch.out Fri Mar 14 21:35:49 2008 +0100
+++ b/tests/test-fetch.out Fri Mar 14 21:36:09 2008 +0100
@@ -41,7 +41,7 @@
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
merging with 1:5e056962225c
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-new changeset 3:0b6439e938f9 merges remote changes with local
+new changeset 3:... merges remote changes with local
Automated merge with http://localhost:20059/
% fetch over http with auth (should be hidden in desc)
pulling from http://user:***@localhost:20059/
@@ -54,7 +54,7 @@
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
merging with 1:5e056962225c
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-new changeset 3:0b6439e938f9 merges remote changes with local
+new changeset 3:... merges remote changes with local
Automated merge with http://localhost:20059/
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-hgweb.out Fri Mar 14 21:35:49 2008 +0100
+++ b/tests/test-hgweb.out Fri Mar 14 21:36:09 2008 +0100
@@ -147,4 +147,8 @@
background-color: #aaffaa;
border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
}
+span.logtags span.inbranchtag {
+ background-color: #d5dde6;
+ border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4;
+}
% errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-force Fri Mar 14 21:36:09 2008 +0100
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+hg init repo
+cd repo
+
+echo a > a
+hg ci -qAm 'add a'
+
+echo b > b
+hg ci -qAm 'add b'
+
+hg up -qC 0
+hg rm a
+hg ci -m 'rm a'
+
+hg up -qC 1
+rm a
+
+echo '% local deleted a file, remote removed'
+hg merge # should fail, since there are deleted files
+hg -v merge --force
+echo % should show a as removed
+hg st
+
+hg ci -m merge
+echo % manifest. should not have a:
+hg manifest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-force.out Fri Mar 14 21:36:09 2008 +0100
@@ -0,0 +1,10 @@
+% local deleted a file, remote removed
+abort: outstanding uncommitted changes
+resolving manifests
+removing a
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% should show a as removed
+R a
+% manifest. should not have a:
+b
--- a/tests/test-symlink-basic Fri Mar 14 21:35:49 2008 +0100
+++ b/tests/test-symlink-basic Fri Mar 14 21:36:09 2008 +0100
@@ -38,3 +38,13 @@
hg cp -v dangling dangling2
hg st -Cmard
$TESTDIR/readlink.py dangling dangling2
+
+echo '% issue995'
+hg up -C
+mkdir dir
+ln -s dir dirlink
+hg ci -qAm 'add dirlink'
+mkdir newdir
+mv dir newdir/dir
+mv dirlink newdir/dirlink
+hg mv -A dirlink newdir/dirlink
--- a/tests/test-symlink-basic.out Fri Mar 14 21:35:49 2008 +0100
+++ b/tests/test-symlink-basic.out Fri Mar 14 21:36:09 2008 +0100
@@ -27,3 +27,5 @@
dangling
dangling -> void
dangling2 -> void
+% issue995
+0 files updated, 0 files merged, 1 files removed, 0 files unresolved