--- a/hgext/extdiff.py Tue Oct 10 18:43:20 2006 -0300
+++ b/hgext/extdiff.py Wed Oct 11 23:31:05 2006 +0200
@@ -65,6 +65,9 @@
ui.write_err(_('making snapshot of %d files from rev %s\n') %
(len(files), short(node)))
for fn in files:
+ if not fn in mf:
+ # skipping new file after a merge ?
+ continue
wfn = util.pconvert(fn)
ui.note(' %s\n' % wfn)
dest = os.path.join(base, wfn)
--- a/mercurial/base85.c Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/base85.c Wed Oct 11 23:31:05 2006 +0200
@@ -35,7 +35,7 @@
unsigned int acc, val, ch;
int pad = 0;
- if (!PyArg_ParseTuple(args, "s#|i", &text, &len, &pad))
+ if (!PyArg_ParseTuple(args, "t#|i", &text, &len, &pad))
return NULL;
if (pad)
@@ -82,7 +82,7 @@
int len, i, j, olen, c, cap;
unsigned int acc;
- if (!PyArg_ParseTuple(args, "s#", &text, &len))
+ if (!PyArg_ParseTuple(args, "t#", &text, &len))
return NULL;
olen = len / 5 * 4;
--- a/mercurial/bdiff.c Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/bdiff.c Wed Oct 11 23:31:05 2006 +0200
@@ -300,18 +300,19 @@
static PyObject *bdiff(PyObject *self, PyObject *args)
{
- PyObject *sa, *sb, *result = NULL;
+ char *sa, *sb;
+ PyObject *result = NULL;
struct line *al, *bl;
struct hunklist l = {NULL, NULL};
struct hunk *h;
char encode[12], *rb;
- int an, bn, len = 0, la = 0, lb = 0;
+ int an, bn, len = 0, la, lb;
- if (!PyArg_ParseTuple(args, "SS:bdiff", &sa, &sb))
+ if (!PyArg_ParseTuple(args, "t#t#:bdiff", &sa, &la, &sb, &lb))
return NULL;
- an = splitlines(PyString_AsString(sa), PyString_Size(sa), &al);
- bn = splitlines(PyString_AsString(sb), PyString_Size(sb), &bl);
+ an = splitlines(sa, la, &al);
+ bn = splitlines(sb, lb, &bl);
if (!al || !bl)
goto nomem;
@@ -320,6 +321,7 @@
goto nomem;
/* calculate length of output */
+ la = lb = 0;
for (h = l.base; h != l.head; h++) {
if (h->a1 != la || h->b1 != lb)
len += 12 + bl[h->b1].l - bl[lb].l;
--- a/mercurial/context.py Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/context.py Wed Oct 11 23:31:05 2006 +0200
@@ -48,6 +48,10 @@
elif name == '_manifest':
self._manifest = self._repo.manifest.read(self._changeset[0])
return self._manifest
+ elif name == '_manifestdelta':
+ md = self._repo.manifest.readdelta(self._changeset[0])
+ self._manifestdelta = md
+ return self._manifestdelta
else:
raise AttributeError, name
@@ -72,11 +76,14 @@
return [ changectx(self._repo, x) for x in c ]
def filenode(self, path):
- if hasattr(self, "_manifest"):
+ if '_manifest' in self.__dict__:
try:
return self._manifest[path]
except KeyError:
raise repo.LookupError(_("'%s' not found in manifest") % path)
+ if '_manifestdelta' in self.__dict__ or path in self.files():
+ if path in self._manifestdelta:
+ return self._manifestdelta[path]
node, flag = self._repo.manifest.find(self._changeset[0], path)
if not node:
raise repo.LookupError(_("'%s' not found in manifest") % path)
@@ -140,7 +147,7 @@
return self._changeid
elif name == '_filenode':
try:
- if hasattr(self, "_fileid"):
+ if '_fileid' in self.__dict__:
self._filenode = self._filelog.lookup(self._fileid)
else:
self._filenode = self._changectx.filenode(self._path)
@@ -176,7 +183,7 @@
def filelog(self): return self._filelog
def rev(self):
- if hasattr(self, "_changectx"):
+ if '_changectx' in self.__dict__:
return self._changectx.rev()
return self._filelog.linkrev(self._filenode)
@@ -439,7 +446,7 @@
filelog=self._filelog)
def rev(self):
- if hasattr(self, "_changectx"):
+ if '_changectx' in self.__dict__:
return self._changectx.rev()
return self._filelog.linkrev(self._filenode)
--- a/mercurial/hgweb/hgweb_mod.py Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/hgweb/hgweb_mod.py Wed Oct 11 23:31:05 2006 +0200
@@ -772,8 +772,11 @@
def changectx(self, req):
if req.form.has_key('node'):
changeid = req.form['node'][0]
+ elif req.form.has_key('manifest'):
+ changeid = req.form['manifest'][0]
else:
- changeid = req.form['manifest'][0]
+ changeid = self.repo.changelog.count() - 1
+
try:
ctx = self.repo.changectx(changeid)
except hg.RepoError:
@@ -848,8 +851,7 @@
self.do_changelog(req, shortlog = True)
def do_changeset(self, req):
- ctx = self.repo.changectx(req.form['node'][0])
- req.write(self.changeset(ctx))
+ req.write(self.changeset(self.changectx(req)))
def do_manifest(self, req):
req.write(self.manifest(self.changectx(req),
--- a/mercurial/patch.py Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/patch.py Wed Oct 11 23:31:05 2006 +0200
@@ -467,6 +467,7 @@
to = None
tn = None
dodiff = True
+ header = []
if f in mmap:
to = getfile(f).read(mmap[f])
if f not in removed:
@@ -480,7 +481,6 @@
header.append('new mode %s\n' % nmode)
a, b = f, f
- header = []
if f in added:
if node2:
mode = gitmode(mmap2.execf(f))
@@ -510,11 +510,12 @@
nmode = gitmode(util.is_exec(repo.wjoin(f), mmap.execf(f)))
addmodehdr(header, omode, nmode)
r = None
- if dodiff:
- header.insert(0, 'diff --git a/%s b/%s\n' % (a, b))
+ header.insert(0, 'diff --git a/%s b/%s\n' % (a, b))
+ if dodiff:
+ text = mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts)
+ if text or len(header) > 1:
fp.write(''.join(header))
- if dodiff:
- fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts))
+ fp.write(text)
def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
opts=None):
--- a/mercurial/revlog.py Tue Oct 10 18:43:20 2006 -0300
+++ b/mercurial/revlog.py Wed Oct 11 23:31:05 2006 +0200
@@ -973,7 +973,7 @@
end = self.end(t)
if not d:
prev = self.revision(self.tip())
- d = self.diff(prev, str(text))
+ d = self.diff(prev, text)
data = compress(d)
l = len(data[1]) + len(data[0])
dist = end - start + l
--- a/tests/test-extdiff Tue Oct 10 18:43:20 2006 -0300
+++ b/tests/test-extdiff Wed Oct 11 23:31:05 2006 +0200
@@ -26,4 +26,13 @@
echo b >> a
hg ci -d '1 0' -mtest2
-hg falabala -r 0:1 || echo "diff-like tools yield a non-zero exit code"
+hg falabala -r 0:1
+
+# test diff during merge
+hg update 0
+echo b >> b
+hg add b
+hg ci -m "new branch" -d '1 0'
+hg update -C 1
+hg merge tip
+hg falabala || echo "diff-like tools yield a non-zero exit code"
--- a/tests/test-extdiff.out Tue Oct 10 18:43:20 2006 -0300
+++ b/tests/test-extdiff.out Wed Oct 11 23:31:05 2006 +0200
@@ -29,4 +29,11 @@
making snapshot of 1 files from rev e27a2475d60a
making snapshot of 1 files from rev 5e49ec8d3f05
diffing a.e27a2475d60a a.5e49ec8d3f05
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+making snapshot of 1 files from rev 5e49ec8d3f05
+making snapshot of 1 files from working dir
+diffing a.5e49ec8d3f05 a
diff-like tools yield a non-zero exit code
--- a/tests/test-merge1 Tue Oct 10 18:43:20 2006 -0300
+++ b/tests/test-merge1 Wed Oct 11 23:31:05 2006 +0200
@@ -23,6 +23,8 @@
echo This is file b1 > b
echo %% no merges expected
env HGMERGE=../merge hg merge 1
+hg diff --nodates
+hg status
cd ..; /bin/rm -rf t
mkdir t
@@ -44,6 +46,8 @@
env HGMERGE=../merge hg merge 1
echo %% merge of b expected
env HGMERGE=../merge hg merge -f 1
+hg diff --nodates
+hg status
cd ..; /bin/rm -rf t
echo %%
@@ -71,6 +75,8 @@
env HGMERGE=../merge hg merge 2
echo %% merge expected!
env HGMERGE=../merge hg merge -f 2
+hg diff --nodates
+hg status
cd ..; /bin/rm -rf t
mkdir t
@@ -93,4 +99,6 @@
env HGMERGE=../merge hg merge 2
echo %% merge of b expected
env HGMERGE=../merge hg merge -f 2
+hg diff --nodates
+hg status
cd ..; /bin/rm -rf t
--- a/tests/test-merge1.out Tue Oct 10 18:43:20 2006 -0300
+++ b/tests/test-merge1.out Wed Oct 11 23:31:05 2006 +0200
@@ -2,6 +2,12 @@
%% no merges expected
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
+diff -r d9e5953b9dec b
+--- /dev/null
++++ b/b
+@@ -0,0 +1,1 @@
++This is file b1
+M b
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
%% merge should fail
abort: 'b' already exists in the working dir and differs from remote
@@ -10,6 +16,12 @@
merging b
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
+diff -r d9e5953b9dec b
+--- /dev/null
++++ b/b
+@@ -0,0 +1,1 @@
++This is file b2
+M b
%%
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Contents of b should be "this is file b1"
@@ -19,6 +31,13 @@
%% merge expected!
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
+diff -r c1dd73cbf59f b
+--- a/b
++++ b/b
+@@ -1,1 +1,1 @@ This is file b1
+-This is file b1
++This is file b22
+M b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
%% merge of b should fail
abort: outstanding uncommitted changes
@@ -27,3 +46,10 @@
merging b
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
+diff -r c1dd73cbf59f b
+--- a/b
++++ b/b
+@@ -1,1 +1,1 @@ This is file b1
+-This is file b1
++This is file b33
+M b
--- a/tests/test-mq Tue Oct 10 18:43:20 2006 -0300
+++ b/tests/test-mq Wed Oct 11 23:31:05 2006 +0200
@@ -160,6 +160,17 @@
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
hg status
+echo % qpush failure
+cd ..
+hg qrefresh
+hg qnew -mbar bar
+echo foo > foo
+hg add foo
+hg qrefresh
+hg qpop -a
+echo bar > foo
+hg qpush -a
+
cat >>$HGRCPATH <<EOF
[diff]
git = True
--- a/tests/test-mq.out Tue Oct 10 18:43:20 2006 -0300
+++ b/tests/test-mq.out Wed Oct 11 23:31:05 2006 +0200
@@ -164,6 +164,14 @@
@@ -0,0 +1,1 @@
+f
M a
+% qpush failure
+Patch queue now empty
+applying foo
+applying bar
+1 out of 1 hunk ignored -- saving rejects to file foo.rej
+patch failed, unable to continue (try -v)
+patch failed, rejects left in working dir
+Errors during apply, please fix and refresh bar
new file
diff --git a/new b/new