--- a/mercurial/cmdutil.py Mon Nov 26 17:23:20 2007 -0800
+++ b/mercurial/cmdutil.py Mon Nov 26 17:24:21 2007 -0800
@@ -571,26 +571,26 @@
def showcopies(**args):
c = [{'name': x[0], 'source': x[1]} for x in copies]
return showlist('file_copy', c, plural='file_copies', **args)
-
- if self.ui.debugflag:
- files = self.repo.status(log.parents(changenode)[0], changenode)[:3]
- def showfiles(**args):
- return showlist('file', files[0], **args)
- def showadds(**args):
- return showlist('file_add', files[1], **args)
- def showdels(**args):
- return showlist('file_del', files[2], **args)
- def showmanifest(**args):
- args = args.copy()
- args.update(dict(rev=self.repo.manifest.rev(changes[0]),
- node=hex(changes[0])))
- return self.t('manifest', **args)
- else:
- def showfiles(**args):
- return showlist('file', changes[3], **args)
- showadds = ''
- showdels = ''
- showmanifest = ''
+
+ files = []
+ def getfiles():
+ if not files:
+ files[:] = self.repo.status(
+ log.parents(changenode)[0], changenode)[:3]
+ return files
+ def showfiles(**args):
+ return showlist('file', changes[3], **args)
+ def showmods(**args):
+ return showlist('file_mod', getfiles()[0], **args)
+ def showadds(**args):
+ return showlist('file_add', getfiles()[1], **args)
+ def showdels(**args):
+ return showlist('file_del', getfiles()[2], **args)
+ def showmanifest(**args):
+ args = args.copy()
+ args.update(dict(rev=self.repo.manifest.rev(changes[0]),
+ node=hex(changes[0])))
+ return self.t('manifest', **args)
defprops = {
'author': changes[1],
@@ -599,6 +599,7 @@
'desc': changes[4].strip(),
'file_adds': showadds,
'file_dels': showdels,
+ 'file_mods': showmods,
'files': showfiles,
'file_copies': showcopies,
'manifest': showmanifest,
--- a/mercurial/localrepo.py Mon Nov 26 17:23:20 2007 -0800
+++ b/mercurial/localrepo.py Mon Nov 26 17:24:21 2007 -0800
@@ -1710,6 +1710,8 @@
# Go through all our files in order sorted by name.
for fname in changedfiles:
filerevlog = self.file(fname)
+ if filerevlog.count() == 0:
+ raise util.abort(_("empty or missing revlog for %s") % fname)
# Toss out the filenodes that the recipient isn't really
# missing.
if msng_filenode_set.has_key(fname):
@@ -1794,6 +1796,8 @@
for fname in changedfiles:
filerevlog = self.file(fname)
+ if filerevlog.count() == 0:
+ raise util.abort(_("empty or missing revlog for %s") % fname)
nodeiter = gennodelst(filerevlog)
nodeiter = list(nodeiter)
if nodeiter:
--- a/mercurial/patch.py Mon Nov 26 17:23:20 2007 -0800
+++ b/mercurial/patch.py Mon Nov 26 17:24:21 2007 -0800
@@ -357,7 +357,7 @@
if len(cand) > 1:
# resort our list of potentials forward then back.
- cand.sort(cmp=sorter)
+ cand.sort(sorter)
return cand
def hashlines(self):
--- a/mercurial/revlog.py Mon Nov 26 17:23:20 2007 -0800
+++ b/mercurial/revlog.py Mon Nov 26 17:24:21 2007 -0800
@@ -321,7 +321,7 @@
e = _unpack(indexformatv0, cur)
# transform to revlogv1 format
e2 = (offset_type(e[0], 0), e[1], -1, e[2], e[3],
- nodemap[e[4]], nodemap[e[5]], e[6])
+ nodemap.get(e[4], nullrev), nodemap.get(e[5], nullrev), e[6])
index.append(e2)
nodemap[e[6]] = n
n += 1
--- a/templates/map-cmdline.default Mon Nov 26 17:23:20 2007 -0800
+++ b/templates/map-cmdline.default Mon Nov 26 17:24:21 2007 -0800
@@ -1,10 +1,13 @@
changeset = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
changeset_quiet = '{rev}:{node|short}\n'
-changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}description:\n{desc|strip}\n\n\n'
-changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{files}{file_adds}{file_dels}{file_copies}{extras}description:\n{desc|strip}\n\n\n'
+changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\n{files}{file_copies}description:\n{desc|strip}\n\n\n'
+changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies}{extras}description:\n{desc|strip}\n\n\n'
start_files = 'files: '
file = ' {file}'
end_files = '\n'
+start_file_mods = 'files: '
+file_mod = ' {file_mod}'
+end_file_mods = '\n'
start_file_adds = 'files+: '
file_add = ' {file_add}'
end_file_adds = '\n'
--- a/tests/test-command-template Mon Nov 26 17:23:20 2007 -0800
+++ b/tests/test-command-template Mon Nov 26 17:24:21 2007 -0800
@@ -89,8 +89,8 @@
cat changelog
echo "# keys work"
-for key in author branches date desc file_adds file_dels files \
- manifest node parents rev tags; do
+for key in author branches date desc file_adds file_dels file_mods \
+ files manifest node parents rev tags; do
for mode in '' --verbose --debug; do
hg log $mode --template "$key$mode: {$key}\n"
done
--- a/tests/test-command-template.out Mon Nov 26 17:23:20 2007 -0800
+++ b/tests/test-command-template.out Mon Nov 26 17:24:21 2007 -0800
@@ -260,22 +260,22 @@
other 3
desc--debug: line 1
line 2
-file_adds:
-file_adds:
+file_adds: second
file_adds:
-file_adds:
-file_adds:
-file_adds:
+file_adds: d
file_adds:
file_adds:
+file_adds: c
+file_adds: b
+file_adds: a
+file_adds--verbose: second
file_adds--verbose:
-file_adds--verbose:
+file_adds--verbose: d
file_adds--verbose:
file_adds--verbose:
-file_adds--verbose:
-file_adds--verbose:
-file_adds--verbose:
-file_adds--verbose:
+file_adds--verbose: c
+file_adds--verbose: b
+file_adds--verbose: a
file_adds--debug: second
file_adds--debug:
file_adds--debug: d
@@ -308,6 +308,30 @@
file_dels--debug:
file_dels--debug:
file_dels--debug:
+file_mods:
+file_mods:
+file_mods:
+file_mods:
+file_mods: c
+file_mods:
+file_mods:
+file_mods:
+file_mods--verbose:
+file_mods--verbose:
+file_mods--verbose:
+file_mods--verbose:
+file_mods--verbose: c
+file_mods--verbose:
+file_mods--verbose:
+file_mods--verbose:
+file_mods--debug:
+file_mods--debug:
+file_mods--debug:
+file_mods--debug:
+file_mods--debug: c
+file_mods--debug:
+file_mods--debug:
+file_mods--debug:
files: second
files:
files: d
@@ -324,30 +348,30 @@
files--verbose: c
files--verbose: b
files--verbose: a
-files--debug:
+files--debug: second
files--debug:
-files--debug:
+files--debug: d
files--debug:
files--debug: c
-files--debug:
-files--debug:
-files--debug:
-manifest:
-manifest:
-manifest:
-manifest:
-manifest:
-manifest:
-manifest:
-manifest:
-manifest--verbose:
-manifest--verbose:
-manifest--verbose:
-manifest--verbose:
-manifest--verbose:
-manifest--verbose:
-manifest--verbose:
-manifest--verbose:
+files--debug: c
+files--debug: b
+files--debug: a
+manifest: 7:f2dbc354b94e
+manifest: 6:91015e9dbdd7
+manifest: 5:4dc3def4f9b4
+manifest: 4:90ae8dda64e1
+manifest: 3:cb5a1327723b
+manifest: 2:6e0e82995c35
+manifest: 1:4e8d705b1e53
+manifest: 0:a0c8bcbbb45c
+manifest--verbose: 7:f2dbc354b94e
+manifest--verbose: 6:91015e9dbdd7
+manifest--verbose: 5:4dc3def4f9b4
+manifest--verbose: 4:90ae8dda64e1
+manifest--verbose: 3:cb5a1327723b
+manifest--verbose: 2:6e0e82995c35
+manifest--verbose: 1:4e8d705b1e53
+manifest--verbose: 0:a0c8bcbbb45c
manifest--debug: 7:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
manifest--debug: 6:91015e9dbdd76a6791085d12b0a0ec7fcd22ffbf
manifest--debug: 5:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
--- a/tests/test-import Mon Nov 26 17:23:20 2007 -0800
+++ b/tests/test-import Mon Nov 26 17:24:21 2007 -0800
@@ -129,3 +129,27 @@
hg --cwd b tip | grep someoneelse
echo "% should be empty"
hg --cwd b status
+
+
+# Test fuzziness (ambiguous patch location, fuzz=2)
+echo % test fuzziness
+hg init fuzzy
+cd fuzzy
+echo line1 > a
+echo line0 >> a
+echo line3 >> a
+hg ci -Am adda
+echo line1 > a
+echo line2 >> a
+echo line0 >> a
+echo line3 >> a
+hg ci -m change a
+hg export tip > tip.patch
+hg up -C 0
+echo line1 > a
+echo line0 >> a
+echo line1 >> a
+echo line0 >> a
+hg ci -m brancha
+hg import -v tip.patch
+cd ..
--- a/tests/test-import.out Mon Nov 26 17:23:20 2007 -0800
+++ b/tests/test-import.out Mon Nov 26 17:24:21 2007 -0800
@@ -125,3 +125,10 @@
% committer should be 'someoneelse'
user: someoneelse
% should be empty
+% test fuzziness
+adding a
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+applying tip.patch
+patching file a
+Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
+a