[PATCH 5 of 5] diff: rewrite trydiff and add index support to diff --git (issue1268)
Guillermo Pérez
bisho at fb.com
Wed Nov 21 17:28:17 UTC 2012
# HG changeset patch
# User Guillermo Pérez <bisho at fb.com>
# Date 1353518802 28800
# Node ID 50969d3c17ad744822f44ff2515ef294b04fd279
# Parent a03561228cb1d473a018f05a35b4c88f04db2c45
diff: rewrite trydiff and add index support to diff --git (issue1268)
Easier to read and follow, better rename detection
(properly recognizes b->c, a->b that previously created
a diff that fails to be imported in git), fewer git details
hardcoded in the flow and a single place to call
losedatafn.
Now the diff processing is split:
1) we classify files into copied, moved, created, modified, deleted
2) we go among them adding meta data headers by calling to handlers.
Those handlers only add headers for git, but in the future more diff
engines can be added with ease, just modifying the handlers.
3) if metadata is needed to avoid losing information, we flag it with a
boolean flag, and call to the handler just once, not in many distinct
places all scattered among the code.
diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -142,6 +142,12 @@
yield s, type
yield s1, '='
+def bindiff(a, ad, b, bd, fn1, fn2, opts=defaultopts):
+ if opts.git:
+ return b85diff(a, b)
+ else:
+ return unidiff(a, ad, b, bd, fn1, fn2, opts=defaultopts)
+
def unidiff(a, ad, b, bd, fn1, fn2, opts=defaultopts):
def datetag(date, fn=None):
if not opts.git and not opts.nodates:
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1679,13 +1679,23 @@
elif fa is not None and fb is None:
meta.append('deleted file mode %s\n' % gitmode[fa])
- def addindexmeta(meta, revs):
+ def addindexmeta(meta, revs, ta, tb, binary):
if opts.git:
i = len(revs)
+ gitrevs = revs[:]
+ if binary:
+ # Git revs for binary are hashes of content
+ gitrevs = [gitindex(ta), gitindex(tb)]
+ i = 2
+ elif ta is None:
+ gitrevs[0] = '000000000000'
+ elif tb is None:
+ gitrevs[(i - 1)] = '000000000000'
+
if i==2:
- meta.append('index %s..%s\n' % tuple(revs))
+ meta.append('index %s..%s\n' % tuple(gitrevs))
elif i==3:
- meta.append('index %s,%s..%s\n' % tuple(revs))
+ meta.append('index %s,%s..%s\n' % tuple(gitrevs))
def gitindex(text):
if not text:
@@ -1708,96 +1718,143 @@
line = ''
return line
+ if opts.git and len(revs) <= 1:
+ # To generate appropiate index header in git diffs we need
+ # at least two versions, extract them from ctx:
+ revs = [str(ctx1), str(ctx2)]
+
date1 = util.datestr(ctx1.date())
man1 = ctx1.manifest()
- gone = set()
+ # Classify copy info in renames and copies
+ renamed = {}
+ copied = []
+ deleted = removed
+ if opts.git or losedatafn:
+ copied = copy.copy()
+ deleted = removed[:] # Copy since we may modify it
+ for f in copy:
+ if f not in added:
+ # Git does not support renames/copies overwriting
+ # an existing file. They need to be represented
+ # via normal modification/deletion losing this
+ # bit of info.
+ del copied[f]
+ continue
+ source = copy[f]
+ if source in deleted:
+ # if the source file is removed, is
+ # a rename (simple case)
+ renamed[f] = source
+ del copied[f]
+ if opts.git:
+ # Renames are reported twice:
+ # - as a file added
+ # - as a file deleted
+ # In git mode that support rename metadata
+ # we just need to report the new file as
+ # a rename, deleted file should be omitted
+ deleted.remove(source)
+ if source in copy:
+ # source file is also a copy destination,
+ # this is a double rename (overwrite).
+ # Should be in deleted, but it's not due
+ # to the second rename
+ renamed[f] = source
+ del copied[f]
- copyto = dict([(v, k) for k, v in copy.items()])
+ # Process each file
+ for f in sorted(modified + added + deleted):
+ meta = []
+ needsmeta = False
+ binary = False
+ a, b = f, f
- if opts.git:
- revs = None
+ # Detect change type
+ if f in deleted:
+ b = None
+ elif f in renamed:
+ a = renamed[f]
+ addrenamemeta(meta, a, b)
+ needsmeta = True
+ elif f in copied:
+ a = copied[f]
+ addcopymeta(meta, a, b)
+ needsmeta = True
+ elif f in added:
+ # Added but not from rename / copy
+ a = None
+ if (ctx2.flags(b) != ''):
+ # If new file has custom flags, needs metadata
+ needsmeta = True
+ #else:
+ # modified
- for f in sorted(modified + added + removed):
- to = None
- tn = None
- oflag = None
- nflag = None
- dodiff = True
- header = []
- if f in man1:
- to = getfilectx(f, ctx1).data()
- if f not in removed:
- tn = getfilectx(f, ctx2).data()
- a, b = f, f
- if opts.git or losedatafn:
- if f in added:
- nflag = ctx2.flags(f)
- if f in copy or f in copyto:
- if opts.git:
- if f in copy:
- a = copy[f]
- else:
- a = copyto[f]
- oflag = man1.flags(a)
- if a in removed and a not in gone:
- addrenamemeta(header, join(a), join(f))
- gone.add(a)
- else:
- addcopymeta(header, join(a), join(f))
- to = getfilectx(a, ctx1).data()
- else:
- losedatafn(f)
- elif not opts.git and ctx2.flags(f):
- losedatafn(f)
- # In theory, if tn was copied or renamed we should check
- # if the source is binary too but the copy record already
- # forces git mode.
- if util.binary(tn):
- if opts.git:
- dodiff = 'binary'
- else:
- losedatafn(f)
- if not opts.git and not tn:
- # regular diffs cannot represent new empty file
- losedatafn(f)
- elif f in removed:
- oflag = man1.flags(f)
- if opts.git:
- # have we already reported a copy above?
- if ((f in copy and copy[f] in added
- and copyto[copy[f]] == f) or
- (f in copyto and copyto[f] in added
- and copy[copyto[f]] == f)):
- dodiff = False
- elif not to or util.binary(to):
- # regular diffs cannot represent empty file deletion
- losedatafn(f)
+ # Grab file contents and flags
+ ta, tb = None, None
+ fa, fb = None, None
+ if a:
+ if a in man1:
+ # largefiles won't be included in manifest
+ ta = getfilectx(a, ctx1).data()
+ fa = ctx1.flags(a)
+ else:
+ a = f
+
+ if b:
+ tb = getfilectx(b, ctx2).data()
+ fb = ctx2.flags(b)
+ else:
+ b = f
+
+ # Check for empty files
+ if not ta and not tb:
+ # regular diffs cannot represent empty file deletion/add
+ needsmeta = True
+
+ # Check for binary files
+ if (ta and util.binary(ta)) or (tb and util.binary(tb)):
+ # Requires binary patch
+ needsmeta = True
+ if b not in deleted:
+ binary = True
+
+ # Add flags meta
+ addflagsmeta(meta, fa, fb)
+ if fa is not None and fb is not None and fa != fb:
+ # Flags have changed
+ needsmeta = True
+
+ # Check if any of the checks before has detected the need for
+ # adding metadata to avoid losing information
+ if needsmeta and losedatafn and not opts.git:
+ # This patch needs meta to avoid losing info
+ losedatafn(f)
+
+ # Generate diff text
+ if ta == tb:
+ text = ''
+ else:
+ a, b = join(a), join(b)
+ if binary and not opts.text:
+ text = mdiff.bindiff(ta, date1,
+ # ctx2 date may be dynamic
+ tb, util.datestr(ctx2.date()),
+ a, b, opts=opts)
else:
- oflag = man1.flags(f)
- nflag = ctx2.flags(f)
- binary = util.binary(to) or util.binary(tn)
- if opts.git:
- if binary:
- dodiff = 'binary'
- elif binary or nflag != oflag:
- losedatafn(f)
+ text = mdiff.unidiff(ta, date1,
+ # ctx2 date may be dynamic
+ tb, util.datestr(ctx2.date()),
+ a, b, opts=opts)
- addflagsmeta(header, oflag, nflag)
- if dodiff:
- if opts.git or revs:
- header.insert(0, diffline(join(a), join(b), revs))
- if dodiff == 'binary':
- text = mdiff.b85diff(to, tn)
- if text:
- addindexmeta(header, [gitindex(to), gitindex(tn)])
- else:
- text = mdiff.unidiff(to, date1,
- # ctx2 date may be dynamic
- tn, util.datestr(ctx2.date()),
- join(a), join(b), opts=opts)
- if header and (text or len(header) > 1):
- yield ''.join(header)
+ # Add index metadata
+ addindexmeta(meta, revs, ta, tb, binary)
+
+ # Generate diffline, headers and diff output for this file
+ if text or meta:
+ yield diffline(a, b, revs)
+ if meta:
+ yield ''.join(meta)
if text:
yield text
diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t
--- a/tests/test-diff-unified.t
+++ b/tests/test-diff-unified.t
@@ -124,6 +124,7 @@
$ hg diff -U0 --nodates --git
diff --git a/f1 b/f1
+ index 55d8ff78db23..55d8ff78db23+
--- a/f1
+++ b/f1
@@ -0,0 +1,1 @@
@@ -165,6 +166,7 @@
diff --git a/f1 b/f 1
rename from f1
rename to f 1
+ index 7574207d0d15..7574207d0d15+
--- a/f1
+++ b/f 1
@@ -1,1 +1,1 @@
@@ -189,6 +191,7 @@
diff --git a/f 1 b/f1
rename from f 1
rename to f1
+ index ca50fe67c9c7..ca50fe67c9c7+
--- a/f 1
+++ b/f1
@@ -1,1 +1,1 @@
diff --git a/tests/test-diff-upgrade.t b/tests/test-diff-upgrade.t
--- a/tests/test-diff-upgrade.t
+++ b/tests/test-diff-upgrade.t
@@ -109,6 +109,7 @@
$ hg autodiff --git=yes regular
diff --git a/regular b/regular
+ index a66d19b9302d..a66d19b9302d+
--- a/regular
+++ b/regular
@@ -1,1 +1,2 @@
@@ -157,6 +158,7 @@
% git=auto: git diff for newexec
diff --git a/newexec b/newexec
new file mode 100755
+ index 000000000000..a66d19b9302d+
--- /dev/null
+++ b/newexec
@@ -0,0 +1,1 @@
@@ -192,14 +194,17 @@
% git=auto: git diff for newempty
diff --git a/newempty b/newempty
new file mode 100644
+ index 000000000000..a66d19b9302d+
% git=auto: git diff for rmempty
diff --git a/rmempty b/rmempty
deleted file mode 100644
+ index a66d19b9302d..000000000000
% git=auto: git diff for rmbinary
diff --git a/rmbinary b/rmbinary
deleted file mode 100644
+ index a66d19b9302d..000000000000
Binary file rmbinary has changed
% git=auto: git diff for bintoregular
diff --git a/tests/test-eol-add.t b/tests/test-eol-add.t
--- a/tests/test-eol-add.t
+++ b/tests/test-eol-add.t
@@ -76,6 +76,7 @@
diff --git a/.hgeol b/.hgeol
new file mode 100644
+ index 000000000000..33503edb53b0
--- /dev/null
+++ b/.hgeol
@@ -0,0 +1,4 @@
@@ -104,6 +105,7 @@
diff --git a/.hgeol b/.hgeol
new file mode 100644
+ index 000000000000..6e64eaa9eb23
--- /dev/null
+++ b/.hgeol
@@ -0,0 +1,4 @@
@@ -112,6 +114,7 @@
+[repository]
+native = CRLF
diff --git a/a.txt b/a.txt
+ index 0080a2a8799e..6e64eaa9eb23
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,3 @@
diff --git a/tests/test-eol-patch.t b/tests/test-eol-patch.t
--- a/tests/test-eol-patch.t
+++ b/tests/test-eol-patch.t
@@ -15,6 +15,12 @@
> fi
> }
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
$ makerepo () {
> seteol $1
> echo
@@ -60,7 +66,7 @@
> printf "first\r\nthird\r\n" > win.txt
> printf "first\nthird\n" > unix.txt
> echo '% hg diff'
- > hg diff > p
+ > hg diff | indexfilter > p
> cat p
> echo '% hg revert'
> hg revert --all
@@ -73,7 +79,7 @@
> echo '% win.txt'
> cat win.txt
> echo '% hg diff -c tip'
- > hg diff -c tip
+ > hg diff -c tip | indexfilter
> cd ..
> rm -r repo-$1
> }
@@ -106,6 +112,7 @@
third\r (esc)
% hg diff
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>+
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -113,6 +120,7 @@
-second
third
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>+
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -120,6 +128,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>+
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -143,6 +152,7 @@
third\r (esc)
% hg diff -c tip
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -150,6 +160,7 @@
-second
third
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -157,6 +168,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -181,6 +193,7 @@
third\r (esc)
% hg diff
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>+
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -188,6 +201,7 @@
-second
third
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>+
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -195,6 +209,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>+
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -218,6 +233,7 @@
third\r (esc)
% hg diff -c tip
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -225,6 +241,7 @@
-second
third
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -232,6 +249,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -265,6 +283,7 @@
third\r (esc)
% hg diff
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>+
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -272,6 +291,7 @@
-second\r (esc)
third\r (esc)
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>+
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -279,6 +299,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>+
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -302,6 +323,7 @@
third\r (esc)
% hg diff -c tip
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -309,6 +331,7 @@
-second\r (esc)
third\r (esc)
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -316,6 +339,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -340,6 +364,7 @@
third\r (esc)
% hg diff
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>+
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -347,6 +372,7 @@
-second\r (esc)
third\r (esc)
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>+
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -354,6 +380,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>+
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
@@ -377,6 +404,7 @@
third\r (esc)
% hg diff -c tip
diff --git a/native.txt b/native.txt
+ index <hash>..<hash>
--- a/native.txt
+++ b/native.txt
@@ -1,3 +1,2 @@
@@ -384,6 +412,7 @@
-second\r (esc)
third\r (esc)
diff --git a/unix.txt b/unix.txt
+ index <hash>..<hash>
--- a/unix.txt
+++ b/unix.txt
@@ -1,3 +1,2 @@
@@ -391,6 +420,7 @@
-second
third
diff --git a/win.txt b/win.txt
+ index <hash>..<hash>
--- a/win.txt
+++ b/win.txt
@@ -1,3 +1,2 @@
diff --git a/tests/test-eol-update.t b/tests/test-eol-update.t
--- a/tests/test-eol-update.t
+++ b/tests/test-eol-update.t
@@ -96,6 +96,7 @@
third
% hg diff
diff --git a/a.txt b/a.txt
+ index ec40826ca5ff..ec40826ca5ff+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,2 @@
@@ -110,6 +111,7 @@
third
% hg diff
diff --git a/a.txt b/a.txt
+ index e45e3dbef6b5..e45e3dbef6b5+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,2 @@
@@ -129,6 +131,7 @@
third\r (esc)
% hg diff
diff --git a/a.txt b/a.txt
+ index ec40826ca5ff..ec40826ca5ff+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,2 @@
@@ -143,6 +146,7 @@
third
% hg diff
diff --git a/a.txt b/a.txt
+ index e45e3dbef6b5..e45e3dbef6b5+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,2 @@
diff --git a/tests/test-eol.t b/tests/test-eol.t
--- a/tests/test-eol.t
+++ b/tests/test-eol.t
@@ -158,6 +158,7 @@
third
fourth
diff --git a/a.txt b/a.txt
+ index 2c91de36d61a..2c91de36d61a+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -168,6 +169,7 @@
% switching encoding from '\n' to '\r\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
+ index 2c91de36d61a..2c91de36d61a+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -202,6 +204,7 @@
third\r (esc)
fourth\r (esc)
diff --git a/a.txt b/a.txt
+ index 2c91de36d61a..2c91de36d61a+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -212,6 +215,7 @@
% switching encoding from '\r\n' to '\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
+ index 2c91de36d61a..2c91de36d61a+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -252,6 +256,7 @@
third
fourth
diff --git a/a.txt b/a.txt
+ index f88133a65d9e..f88133a65d9e+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -262,6 +267,7 @@
% switching encoding from '\n' to '\r\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
+ index f88133a65d9e..f88133a65d9e+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -296,6 +302,7 @@
third\r (esc)
fourth\r (esc)
diff --git a/a.txt b/a.txt
+ index f88133a65d9e..f88133a65d9e+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
@@ -306,6 +313,7 @@
% switching encoding from '\r\n' to '\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
+ index f88133a65d9e..f88133a65d9e+
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -105,6 +105,7 @@
$ hg diff --git
diff --git a/a b/a
+ index 8a5febb7f867..8a5febb7f867+
--- a/a
+++ b/a
@@ -1,1 +1,1 @@
@@ -113,6 +114,7 @@
diff --git a/b b/b
old mode 100644
new mode 100755
+ index 8a5febb7f867..8a5febb7f867+
--- a/b
+++ b/b
@@ -1,1 +1,1 @@
@@ -144,6 +146,7 @@
$ hg diff --git
diff --git a/a b/a
+ index 8a5febb7f867..8a5febb7f867+
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -153,6 +156,7 @@
diff --git a/b b/b
old mode 100644
new mode 100755
+ index 8a5febb7f867..8a5febb7f867+
--- a/b
+++ b/b
@@ -1,1 +1,2 @@
diff --git a/tests/test-git-export.t b/tests/test-git-export.t
--- a/tests/test-git-export.t
+++ b/tests/test-git-export.t
@@ -3,6 +3,12 @@
$ hg ci -Amstart
adding start
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
New file:
$ echo new > new
@@ -11,6 +17,7 @@
$ hg diff --git -r 0
diff --git a/new b/new
new file mode 100644
+ index 000000000000..41f94d6f7e95+
--- /dev/null
+++ b/new
@@ -0,0 +1,1 @@
@@ -41,6 +48,7 @@
$ hg diff --git -r 3:tip
diff --git a/rename b/rename
deleted file mode 100644
+ index 948458dfe3de..000000000000
--- a/rename
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -79,6 +87,7 @@
rename to dst
old mode 100755
new mode 100644
+ index 16990baf28c7..37f6b812c9dc
--- a/src
+++ b/dst
@@ -3,3 +3,4 @@
@@ -183,10 +192,11 @@
File created before r1 and renamed before r2:
- $ hg diff --git -r -3:-1
+ $ hg diff --git -r -3:-1 | indexfilter
diff --git a/foo b/bar
rename from foo
rename to bar
+ index <hash>..<hash>
--- a/foo
+++ b/bar
@@ -1,2 +1,3 @@
@@ -196,10 +206,11 @@
Reversed:
- $ hg diff --git -r -1:-3
+ $ hg diff --git -r -1:-3 | indexfilter
diff --git a/bar b/foo
rename from bar
rename to foo
+ index <hash>..<hash>
--- a/bar
+++ b/foo
@@ -1,3 +1,2 @@
@@ -209,10 +220,11 @@
File created in r1 and renamed before r2:
- $ hg diff --git -r -4:-1
+ $ hg diff --git -r -4:-1 | indexfilter
diff --git a/foo b/bar
rename from foo
rename to bar
+ index <hash>..<hash>
--- a/foo
+++ b/bar
@@ -1,1 +1,3 @@
@@ -222,10 +234,11 @@
Reversed:
- $ hg diff --git -r -1:-4
+ $ hg diff --git -r -1:-4 | indexfilter
diff --git a/bar b/foo
rename from bar
rename to foo
+ index <hash>..<hash>
--- a/bar
+++ b/foo
@@ -1,3 +1,1 @@
@@ -235,9 +248,10 @@
File created after r1 and renamed before r2:
- $ hg diff --git -r -5:-1
+ $ hg diff --git -r -5:-1 | indexfilter
diff --git a/bar b/bar
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/bar
@@ -0,0 +1,3 @@
@@ -247,9 +261,10 @@
Reversed:
- $ hg diff --git -r -1:-5
+ $ hg diff --git -r -1:-5 | indexfilter
diff --git a/bar b/bar
deleted file mode 100644
+ index <hash>..000000000000
--- a/bar
+++ /dev/null
@@ -1,3 +0,0 @@
@@ -288,9 +303,10 @@
The source of the copy was created after the original rev:
- $ hg diff --git -r -3
+ $ hg diff --git -r -3 | indexfilter
diff --git a/created3 b/created3
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/created3
@@ -0,0 +1,1 @@
@@ -312,9 +328,10 @@
Created between r1 and parent of wd; renamed in the wd:
- $ hg diff --git -r -2
+ $ hg diff --git -r -2 | indexfilter
diff --git a/brand-new2 b/brand-new2
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/brand-new2
@@ -0,0 +1,1 @@
@@ -328,20 +345,21 @@
$ hg ci -m 'multiple renames/copies'
$ hg diff --git -r -2 -r -1
diff --git a/brand-new2 b/brand-new3
+ copy from brand-new2
+ copy to brand-new3
+ diff --git a/brand-new2 b/brand-new3-2
rename from brand-new2
- rename to brand-new3
- diff --git a/brand-new2 b/brand-new3-2
- copy from brand-new2
- copy to brand-new3-2
+ rename to brand-new3-2
Reversed:
- $ hg diff --git -r -1 -r -2
+ $ hg diff --git -r -1 -r -2 | indexfilter
diff --git a/brand-new3 b/brand-new2
rename from brand-new3
rename to brand-new2
diff --git a/brand-new3-2 b/brand-new3-2
deleted file mode 100644
+ index <hash>..000000000000
--- a/brand-new3-2
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -351,9 +369,10 @@
$ echo foo > 'with spaces'
$ hg add 'with spaces'
- $ hg diff --git
+ $ hg diff --git | indexfilter
diff --git a/with spaces b/with spaces
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/with spaces
@@ -0,0 +1,1 @@
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -1875,6 +1875,7 @@
diff --git a/a b/a
new file mode 100644
+ index 000000000000..f8035bb17114
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
@@ -1910,6 +1911,7 @@
| | summary: merge 5 and 4
| |
| | diff --git a/e b/e
+ | | index 99b31f1c2782..fc281d8ff18d
| | --- a/e
| | +++ b/e
| | @@ -1,1 +1,1 @@
@@ -1924,6 +1926,7 @@
| |
| | diff --git a/e b/e
| | new file mode 100644
+ | | index 000000000000..99b31f1c2782
| | --- /dev/null
| | +++ b/e
| | @@ -0,0 +1,1 @@
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -329,6 +329,7 @@
1
diff --git a/a b/a
+ index 4bdb9a9d0b84..64ecd9071ce8
--- a/a
+++ b/a
@@ -1,1 +1,1 @@
diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t
--- a/tests/test-hgweb-diffs.t
+++ b/tests/test-hgweb-diffs.t
@@ -406,15 +406,17 @@
<div class="sourcefirst"> line diff</div>
<div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1"> 1.1</a> new file mode 100644
- <a href="#l1.2" id="l1.2"> 1.2</a> <span class="minusline">--- /dev/null
- </span><a href="#l1.3" id="l1.3"> 1.3</a> <span class="plusline">+++ b/a
- </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="atline">@@ -0,0 +1,1 @@
- </span><a href="#l1.5" id="l1.5"> 1.5</a> <span class="plusline">+a
+ <a href="#l1.2" id="l1.2"> 1.2</a> index 000000000000..0cd96de13884
+ <a href="#l1.3" id="l1.3"> 1.3</a> <span class="minusline">--- /dev/null
+ </span><a href="#l1.4" id="l1.4"> 1.4</a> <span class="plusline">+++ b/a
+ </span><a href="#l1.5" id="l1.5"> 1.5</a> <span class="atline">@@ -0,0 +1,1 @@
+ </span><a href="#l1.6" id="l1.6"> 1.6</a> <span class="plusline">+a
</span></pre></div><div class="source bottomline parity1"><pre><a href="#l2.1" id="l2.1"> 2.1</a> new file mode 100644
- <a href="#l2.2" id="l2.2"> 2.2</a> <span class="minusline">--- /dev/null
- </span><a href="#l2.3" id="l2.3"> 2.3</a> <span class="plusline">+++ b/b
- </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="atline">@@ -0,0 +1,1 @@
- </span><a href="#l2.5" id="l2.5"> 2.5</a> <span class="plusline">+b
+ <a href="#l2.2" id="l2.2"> 2.2</a> index 000000000000..0cd96de13884
+ <a href="#l2.3" id="l2.3"> 2.3</a> <span class="minusline">--- /dev/null
+ </span><a href="#l2.4" id="l2.4"> 2.4</a> <span class="plusline">+++ b/b
+ </span><a href="#l2.5" id="l2.5"> 2.5</a> <span class="atline">@@ -0,0 +1,1 @@
+ </span><a href="#l2.6" id="l2.6"> 2.6</a> <span class="plusline">+b
</span></pre></div>
</div>
@@ -442,12 +444,14 @@
diff --git a/a b/a
new file mode 100644
+ index 000000000000..0cd96de13884
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+a
diff --git a/b b/b
new file mode 100644
+ index 000000000000..0cd96de13884
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -486,6 +486,7 @@
$ touch d
$ hg diff --git
diff --git a/a b/a
+ index 8b15cf174911..8b15cf174911+
--- a/a
+++ b/a
@@ -0,0 +1,1 @@
@@ -493,11 +494,13 @@
diff --git a/b1 b/b2
rename from b1
rename to b2
+ index 8b15cf174911..8b15cf174911+
--- a/b1
+++ b/b2
@@ -0,0 +1,1 @@
+b
diff --git a/c1 b/c1
+ index 8b15cf174911..8b15cf174911+
--- a/c1
+++ b/c1
@@ -0,0 +1,1 @@
@@ -505,11 +508,13 @@
diff --git a/c1 b/c2
copy from c1
copy to c2
+ index 8b15cf174911..8b15cf174911+
--- a/c1
+++ b/c2
@@ -0,0 +1,1 @@
+c
diff --git a/d b/d
+ index 8b15cf174911..8b15cf174911+
--- a/d
+++ b/d
@@ -1,1 +0,0 @@
@@ -861,6 +866,7 @@
diff --git a/foo b/foo
new file mode 100644
+ index 000000000000..eb56ab919036
--- /dev/null
+++ b/foo
@@ -0,0 +1,1 @@
@@ -921,6 +927,7 @@
$ hg diff --git -c tip
diff --git a/lib/place-holder b/lib/place-holder
new file mode 100644
+ index 000000000000..d59915696727
--- /dev/null
+++ b/lib/place-holder
@@ -0,0 +1,2 @@
@@ -928,6 +935,7 @@
+this file helps.
diff --git a/pkg/place-holder b/pkg/place-holder
new file mode 100644
+ index 000000000000..d59915696727
--- /dev/null
+++ b/pkg/place-holder
@@ -0,0 +1,2 @@
@@ -991,10 +999,10 @@
$ hg up -C 0
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ hg diff --git -c1 >want
+ $ hg diff --git -c1 | grep -ve '^index 291c57e61c04..' >want
$ hg diff -c1 | hg import --no-commit -
applying patch from stdin
- $ hg diff --git >have
+ $ hg diff --git | grep -ve '^index 291c57e61c04..' >have
$ diff want have
$ cd ..
diff --git a/tests/test-incoming-outgoing.t b/tests/test-incoming-outgoing.t
--- a/tests/test-incoming-outgoing.t
+++ b/tests/test-incoming-outgoing.t
@@ -202,6 +202,7 @@
diff --git a/foo b/foo
new file mode 100644
+ index 000000000000..00a43fa82f62
--- /dev/null
+++ b/foo
@@ -0,0 +1,1 @@
@@ -213,6 +214,7 @@
summary: 1
diff --git a/foo b/foo
+ index 00a43fa82f62..5460a410df01
--- a/foo
+++ b/foo
@@ -1,1 +1,2 @@
diff --git a/tests/test-issue1175.t b/tests/test-issue1175.t
--- a/tests/test-issue1175.t
+++ b/tests/test-issue1175.t
@@ -50,4 +50,5 @@
diff --git a/b b/b
new file mode 100644
+ index 000000000000..89e8e4be0de2
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -511,6 +511,7 @@
summary: b1.1
diff --git a/b1 b/b1
+ index 302e9dd6890d..2404bbcab562
--- a/b1
+++ b/b1
@@ -1,1 +1,2 @@
diff --git a/tests/test-merge-types.t b/tests/test-merge-types.t
--- a/tests/test-merge-types.t
+++ b/tests/test-merge-types.t
@@ -100,6 +100,7 @@
diff --git a/a b/a
old mode 120000
new mode 100644
+ index 521a1e40188f..521a1e40188f+
--- a/a
+++ b/a
@@ -1,1 +1,1 @@
diff --git a/tests/test-mq-git.t b/tests/test-mq-git.t
--- a/tests/test-mq-git.t
+++ b/tests/test-mq-git.t
@@ -53,6 +53,7 @@
diff --git a/regular b/regular
new file mode 100644
+ index 000000000000..017ef854e040
--- /dev/null
+++ b/regular
@@ -0,0 +1,1 @@
@@ -93,6 +94,7 @@
diff --git a/a b/a
new file mode 100644
+ index 000000000000..55f6a91e22be
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
@@ -110,6 +112,7 @@
diff --git a/a b/a
new file mode 100644
+ index 000000000000..47e3ba58a18c+
--- /dev/null
+++ b/a
@@ -0,0 +1,2 @@
@@ -135,6 +138,7 @@
diff --git a/a b/a
new file mode 100644
+ index 000000000000..55f6a91e22be
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
@@ -152,6 +156,7 @@
diff --git a/a b/a
new file mode 100644
+ index 000000000000..47e3ba58a18c+
--- /dev/null
+++ b/a
@@ -0,0 +1,2 @@
diff --git a/tests/test-mq-merge.t b/tests/test-mq-merge.t
--- a/tests/test-mq-merge.t
+++ b/tests/test-mq-merge.t
@@ -5,6 +5,12 @@
$ echo "[mq]" >> $HGRCPATH
$ echo "git = keep" >> $HGRCPATH
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
Test merge with mq changeset as the second parent:
$ hg init m
@@ -136,11 +142,12 @@
Check patcha is still a git patch:
- $ cat .hg/patches/patcha
+ $ cat .hg/patches/patcha | indexfilter
# HG changeset patch
# Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -149,6 +156,7 @@
+c
diff --git a/aa b/aa
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/aa
@@ -0,0 +1,1 @@
diff --git a/tests/test-mq-qdiff.t b/tests/test-mq-qdiff.t
--- a/tests/test-mq-qdiff.t
+++ b/tests/test-mq-qdiff.t
@@ -138,10 +138,17 @@
qdiff preserve existing git flag:
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
$ hg qrefresh --git
$ echo a >> lines
- $ hg qdiff
+ $ hg qdiff | indexfilter
diff --git a/lines b/lines
+ index <hash>..<hash>+
--- a/lines
+++ b/lines
@@ -1,9 +1,12 @@
diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t
--- a/tests/test-mq-qfold.t
+++ b/tests/test-mq-qfold.t
@@ -19,6 +19,12 @@
$ echo c >> a
$ hg qnew -f p3
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
Fold in the middle of the queue:
$ hg qpop p1
@@ -83,11 +89,12 @@
$ hg qfold git
- $ cat .hg/patches/regular
+ $ cat .hg/patches/regular | indexfilter
# HG changeset patch
# Parent ???????????????????????????????????????? (glob)
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
@@ -98,6 +105,7 @@
diff --git a/a b/aa
copy from a
copy to aa
+ index <hash>..<hash>+
--- a/a
+++ b/aa
@@ -1,3 +1,4 @@
@@ -125,13 +133,14 @@
$ hg qfold regular
- $ cat .hg/patches/git
+ $ cat .hg/patches/git | indexfilter
# HG changeset patch
# Parent ???????????????????????????????????????? (glob)
diff --git a/a b/aa
copy from a
copy to aa
+ index <hash>..<hash>+
--- a/a
+++ b/aa
@@ -1,3 +1,4 @@
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -1,6 +1,11 @@
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
$ catpatch() {
- > cat $1 | sed -e "s/^\(# Parent \).*/\1/"
+ > cat $1 | sed -e "s/^\(# Parent \).*/\1/" | indexfilter
> }
$ echo "[extensions]" >> $HGRCPATH
$ echo "mq=" >> $HGRCPATH
@@ -138,6 +143,7 @@
adding d/b
M d/b
diff --git a/d/b b/d/b
+ index <hash>..<hash>
--- a/d/b
+++ b/d/b
@@ -1,1 +1,2 @@
@@ -209,6 +215,7 @@
# HG changeset patch
# Parent
diff --git a/d/b b/d/b
+ index <hash>..<hash>
--- a/d/b
+++ b/d/b
@@ -1,1 +1,2 @@
diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
--- a/tests/test-mq-qrefresh.t
+++ b/tests/test-mq-qrefresh.t
@@ -356,14 +356,23 @@
$ hg copy a ac
$ echo c >> ac
+Helper:
+
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
Capture changes:
$ hg qnew -f p1
- $ hg qdiff
+ $ hg qdiff | indexfilter
diff --git a/a b/ab
copy from a
copy to ab
+ index <hash>..<hash>+
--- a/a
+++ b/ab
@@ -1,1 +1,2 @@
@@ -372,6 +381,7 @@
diff --git a/a b/ac
copy from a
copy to ac
+ index <hash>..<hash>+
--- a/a
+++ b/ac
@@ -1,1 +1,2 @@
@@ -382,10 +392,11 @@
$ hg qrefresh
- $ hg qdiff
+ $ hg qdiff | indexfilter
diff --git a/a b/ab
copy from a
copy to ab
+ index <hash>..<hash>+
--- a/a
+++ b/ab
@@ -1,1 +1,2 @@
@@ -394,6 +405,7 @@
diff --git a/a b/ac
copy from a
copy to ac
+ index <hash>..<hash>+
--- a/a
+++ b/ac
@@ -1,1 +1,2 @@
@@ -478,9 +490,10 @@
$ hg mv a b
$ hg qrefresh
- $ hg qdiff --nodates
+ $ hg qdiff --nodates | indexfilter
diff --git a/b b/b
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
@@ -504,11 +517,12 @@
abort: username 'foo\nbar' contains a newline!
[255]
$ rm a
- $ cat .hg/patches/a
+ $ cat .hg/patches/a | indexfilter
# HG changeset patch
# Parent 0000000000000000000000000000000000000000
diff --git a/a b/a
new file mode 100644
+ index 000000000000..<hash>
$ hg qpush
applying a
now at: a
@@ -518,11 +532,12 @@
refresh interrupted while patch was popped! (revert --all, qpush to recover)
abort: empty username!
[255]
- $ cat .hg/patches/a
+ $ cat .hg/patches/a | indexfilter
# HG changeset patch
# Parent 0000000000000000000000000000000000000000
diff --git a/a b/a
new file mode 100644
+ index 000000000000..<hash>
$ cd ..
Refresh with phase data:
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -931,11 +931,19 @@
$ hg add new
$ hg qrefresh
#if execbit
- $ cat .hg/patches/new
+
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
+
+ $ cat .hg/patches/new | indexfilter
new file
diff --git a/new b/new
new file mode 100755
+ index 000000000000..<hash>+
--- /dev/null
+++ b/new
@@ -0,0 +1,1 @@
@@ -1023,9 +1031,10 @@
$ hg up -C 1
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg qrefresh --git
- $ cat .hg/patches/bar
+ $ cat .hg/patches/bar | indexfilter
diff --git a/bar b/bar
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/bar
@@ -0,0 +1,1 @@
@@ -1036,9 +1045,10 @@
$ hg log -v --template '{rev} {file_copies}\n' -r .
2 baz (foo)
$ hg qrefresh --git
- $ cat .hg/patches/bar
+ $ cat .hg/patches/bar | indexfilter
diff --git a/bar b/bar
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/bar
@@ -0,0 +1,1 @@
@@ -1065,12 +1075,13 @@
$ hg mv bar quux
$ hg mv baz bleh
$ hg qrefresh --git
- $ cat .hg/patches/bar
+ $ cat .hg/patches/bar | indexfilter
diff --git a/foo b/bleh
rename from foo
rename to bleh
diff --git a/quux b/quux
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/quux
@@ -0,0 +1,1 @@
@@ -1080,12 +1091,13 @@
$ hg mv quux fred
$ hg mv bleh barney
$ hg qrefresh --git
- $ cat .hg/patches/bar
+ $ cat .hg/patches/bar | indexfilter
diff --git a/foo b/barney
rename from foo
rename to barney
diff --git a/fred b/fred
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/fred
@@ -0,0 +1,1 @@
diff --git a/tests/test-mv-cp-st-diff.t b/tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t
+++ b/tests/test-mv-cp-st-diff.t
@@ -3,6 +3,11 @@
> {
> echo $2 >> $1
> }
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
$ hg init t
$ cd t
@@ -26,7 +31,7 @@
> echo "- $2: $1"
> hg st -C $1
> echo
- > hg diff --git $1
+ > hg diff --git $1 | indexfilter
> echo
> }
$ count=0
@@ -87,6 +92,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,1 +1,4 @@
@@ -104,6 +110,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,3 +1,4 @@
@@ -115,6 +122,7 @@
+a2
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -124,6 +132,7 @@
M a
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,1 +1,4 @@
@@ -136,6 +145,7 @@
M a
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,4 +1,1 @@
@@ -149,6 +159,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
@@ -160,6 +171,7 @@
+a2
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -170,6 +182,7 @@
A x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,4 +1,3 @@
@@ -181,6 +194,7 @@
+m2
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -207,6 +221,7 @@
a
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,1 +1,4 @@
@@ -217,6 +232,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,1 +1,4 @@
@@ -232,6 +248,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
@@ -244,6 +261,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,3 +1,4 @@
@@ -255,6 +273,7 @@
+a2
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -264,6 +283,7 @@
M a
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,1 +1,4 @@
@@ -276,6 +296,7 @@
M a
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,4 +1,1 @@
@@ -289,6 +310,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
@@ -300,6 +322,7 @@
+a2
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -310,6 +333,7 @@
A x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,4 +1,3 @@
@@ -321,6 +345,7 @@
+m2
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -337,6 +362,7 @@
M b
diff --git a/b b/b
+ index <hash>..<hash>+
--- a/b
+++ b/b
@@ -1,3 +1,4 @@
@@ -353,6 +379,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,1 +1,4 @@
@@ -370,6 +397,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,3 +1,4 @@
@@ -381,6 +409,7 @@
+w
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -394,6 +423,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,1 +1,3 @@
@@ -409,6 +439,7 @@
diff --git a/b b/a
rename from b
rename to a
+ index <hash>..<hash>
--- a/b
+++ b/a
@@ -1,3 +1,1 @@
@@ -425,6 +456,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,3 +1,3 @@
@@ -435,6 +467,7 @@
+b1
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -449,6 +482,7 @@
diff --git a/b b/a
rename from b
rename to a
+ index <hash>..<hash>
--- a/b
+++ b/a
@@ -1,3 +1,3 @@
@@ -459,6 +493,7 @@
+m2
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -475,6 +510,7 @@
M a
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,2 +1,3 @@
@@ -488,6 +524,7 @@
a
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,1 +1,3 @@
@@ -497,6 +534,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,1 +1,3 @@
@@ -511,6 +549,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,3 +1,3 @@
@@ -522,6 +561,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,3 +1,3 @@
@@ -532,6 +572,7 @@
+b1
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -543,6 +584,7 @@
a
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -551,6 +593,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,1 +1,3 @@
@@ -564,6 +607,7 @@
R b
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,2 +1,1 @@
@@ -571,6 +615,7 @@
-3
diff --git a/b b/b
deleted file mode 100644
+ index <hash>..000000000000
--- a/b
+++ /dev/null
@@ -1,3 +0,0 @@
@@ -585,6 +630,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,3 +1,2 @@
@@ -595,6 +641,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,3 +1,3 @@
@@ -605,6 +652,7 @@
+b1
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -617,6 +665,7 @@
R b
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,2 +1,3 @@
@@ -626,6 +675,7 @@
+m2
diff --git a/b b/b
deleted file mode 100644
+ index <hash>..000000000000
--- a/b
+++ /dev/null
@@ -1,3 +0,0 @@
@@ -634,6 +684,7 @@
-b1
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -663,6 +714,7 @@
diff --git a/a b/d
rename from a
rename to d
+ index <hash>..<hash>+
--- a/a
+++ b/d
@@ -1,1 +1,2 @@
@@ -678,6 +730,7 @@
diff --git a/a b/d
rename from a
rename to d
+ index <hash>..<hash>+
--- a/a
+++ b/d
@@ -1,3 +1,2 @@
@@ -687,6 +740,7 @@
+4
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -700,6 +754,7 @@
diff --git a/a b/c
rename from a
rename to c
+ index <hash>..<hash>
--- a/a
+++ b/c
@@ -1,1 +1,2 @@
@@ -714,6 +769,7 @@
diff --git a/c b/a
rename from c
rename to a
+ index <hash>..<hash>
--- a/c
+++ b/a
@@ -1,2 +1,1 @@
@@ -729,6 +785,7 @@
diff --git a/a b/c
rename from a
rename to c
+ index <hash>..<hash>
--- a/a
+++ b/c
@@ -1,3 +1,2 @@
@@ -738,6 +795,7 @@
+4
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -752,6 +810,7 @@
diff --git a/c b/a
rename from c
rename to a
+ index <hash>..<hash>
--- a/c
+++ b/a
@@ -1,2 +1,3 @@
@@ -761,6 +820,7 @@
+m2
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -791,6 +851,7 @@
a
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -799,6 +860,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,1 +1,2 @@
@@ -807,6 +869,7 @@
diff --git a/a b/c
copy from a
copy to c
+ index <hash>..<hash>+
--- a/a
+++ b/c
@@ -1,1 +1,2 @@
@@ -815,6 +878,7 @@
diff --git a/a b/d
copy from a
copy to d
+ index <hash>..<hash>+
--- a/a
+++ b/d
@@ -1,1 +1,2 @@
@@ -832,6 +896,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,3 +1,2 @@
@@ -842,6 +907,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>+
--- a/a
+++ b/b
@@ -1,3 +1,2 @@
@@ -852,6 +918,7 @@
diff --git a/a b/c
copy from a
copy to c
+ index <hash>..<hash>+
--- a/a
+++ b/c
@@ -1,3 +1,2 @@
@@ -862,6 +929,7 @@
diff --git a/a b/d
copy from a
copy to d
+ index <hash>..<hash>+
--- a/a
+++ b/d
@@ -1,3 +1,2 @@
@@ -871,6 +939,7 @@
+5
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -884,6 +953,7 @@
a
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -892,6 +962,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,1 +1,2 @@
@@ -900,6 +971,7 @@
diff --git a/a b/c
copy from a
copy to c
+ index <hash>..<hash>
--- a/a
+++ b/c
@@ -1,1 +1,2 @@
@@ -913,6 +985,7 @@
R c
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,2 +1,1 @@
@@ -920,6 +993,7 @@
-5
diff --git a/b b/b
deleted file mode 100644
+ index <hash>..000000000000
--- a/b
+++ /dev/null
@@ -1,2 +0,0 @@
@@ -927,6 +1001,7 @@
-5
diff --git a/c b/c
deleted file mode 100644
+ index <hash>..000000000000
--- a/c
+++ /dev/null
@@ -1,2 +0,0 @@
@@ -942,6 +1017,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,3 +1,2 @@
@@ -952,6 +1028,7 @@
diff --git a/a b/b
copy from a
copy to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,3 +1,2 @@
@@ -962,6 +1039,7 @@
diff --git a/a b/c
copy from a
copy to c
+ index <hash>..<hash>
--- a/a
+++ b/c
@@ -1,3 +1,2 @@
@@ -971,6 +1049,7 @@
+5
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -984,6 +1063,7 @@
R c
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,2 +1,3 @@
@@ -993,6 +1073,7 @@
+m2
diff --git a/b b/b
deleted file mode 100644
+ index <hash>..000000000000
--- a/b
+++ /dev/null
@@ -1,2 +0,0 @@
@@ -1000,6 +1081,7 @@
-5
diff --git a/c b/c
deleted file mode 100644
+ index <hash>..000000000000
--- a/c
+++ /dev/null
@@ -1,2 +0,0 @@
@@ -1007,6 +1089,7 @@
-5
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -1032,6 +1115,7 @@
M a
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,1 +1,3 @@
@@ -1044,6 +1128,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,3 +1,3 @@
@@ -1054,6 +1139,7 @@
+a1
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -1067,6 +1153,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,1 +1,3 @@
@@ -1082,6 +1169,7 @@
diff --git a/b b/a
rename from b
rename to a
+ index <hash>..<hash>
--- a/b
+++ b/a
@@ -1,3 +1,1 @@
@@ -1098,6 +1186,7 @@
diff --git a/a b/b
rename from a
rename to b
+ index <hash>..<hash>
--- a/a
+++ b/b
@@ -1,3 +1,3 @@
@@ -1108,6 +1197,7 @@
+a1
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -1122,6 +1212,7 @@
diff --git a/b b/a
rename from b
rename to a
+ index <hash>..<hash>
--- a/b
+++ b/a
@@ -1,3 +1,3 @@
@@ -1132,6 +1223,7 @@
+m2
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -1149,6 +1241,7 @@
M y/x
diff --git a/y/x b/y/x
+ index <hash>..<hash>+
--- a/y/x
+++ b/y/x
@@ -1,2 +1,3 @@
@@ -1163,6 +1256,7 @@
R x/x
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -1171,6 +1265,7 @@
diff --git a/x/x b/y/x
rename from x/x
rename to y/x
+ index <hash>..<hash>+
--- a/x/x
+++ b/y/x
@@ -1,1 +1,3 @@
@@ -1186,6 +1281,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>+
--- a/a
+++ b/a
@@ -1,3 +1,2 @@
@@ -1195,6 +1291,7 @@
+7
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -1202,6 +1299,7 @@
diff --git a/x/x b/y/x
rename from x/x
rename to y/x
+ index <hash>..<hash>+
--- a/x/x
+++ b/y/x
@@ -1,1 +1,3 @@
@@ -1216,6 +1314,7 @@
R x/x
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
@@ -1224,6 +1323,7 @@
diff --git a/x/x b/y/x
rename from x/x
rename to y/x
+ index <hash>..<hash>
--- a/x/x
+++ b/y/x
@@ -1,1 +1,2 @@
@@ -1237,6 +1337,7 @@
R y/x
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,2 +1,1 @@
@@ -1245,6 +1346,7 @@
diff --git a/y/x b/x/x
rename from y/x
rename to x/x
+ index <hash>..<hash>
--- a/y/x
+++ b/x/x
@@ -1,2 +1,1 @@
@@ -1259,6 +1361,7 @@
R x/y
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,3 +1,2 @@
@@ -1268,6 +1371,7 @@
+7
diff --git a/x/y b/x/y
deleted file mode 100644
+ index <hash>..000000000000
--- a/x/y
+++ /dev/null
@@ -1,1 +0,0 @@
@@ -1275,6 +1379,7 @@
diff --git a/x/x b/y/x
rename from x/x
rename to y/x
+ index <hash>..<hash>
--- a/x/x
+++ b/y/x
@@ -1,1 +1,2 @@
@@ -1289,6 +1394,7 @@
R y/x
diff --git a/a b/a
+ index <hash>..<hash>
--- a/a
+++ b/a
@@ -1,2 +1,3 @@
@@ -1299,6 +1405,7 @@
diff --git a/y/x b/x/x
rename from y/x
rename to x/x
+ index <hash>..<hash>
--- a/y/x
+++ b/x/x
@@ -1,2 +1,1 @@
@@ -1306,6 +1413,7 @@
-x1
diff --git a/x/y b/x/y
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/x/y
@@ -0,0 +1,1 @@
@@ -1335,12 +1443,14 @@
$ hg diff --git -r 2 -r 1
diff --git a/a b/a
deleted file mode 100644
+ index e3f8c9a78c0a..000000000000
--- a/a
+++ /dev/null
@@ -1,1 +0,0 @@
-a
diff --git a/b b/b
new file mode 100644
+ index 000000000000..ead0c916ddbf
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
diff --git a/tests/test-rebase-mq.t b/tests/test-rebase-mq.t
--- a/tests/test-rebase-mq.t
+++ b/tests/test-rebase-mq.t
@@ -11,6 +11,11 @@
> tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
> EOF
+ $ indexfilter () {
+ > sed -e 's/^index 000000000000\.\.[0-9a-f]\{12\}/index 000000000000..<hash>/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.000000000000/index <hash>..000000000000/' \
+ > -e 's/^index [0-9a-f]\{12\}\.\.[0-9a-f]\{12\}/index <hash>..<hash>/'
+ > }
$ hg init a
$ cd a
@@ -167,11 +172,12 @@
f_git.patch
series
- $ cat .hg/patches/f_git.patch
+ $ cat .hg/patches/f_git.patch | indexfilter
P0 (git)
diff --git a/p b/p
new file mode 100644
+ index 000000000000..<hash>+
--- /dev/null
+++ b/p
@@ -0,0 +1,1 @@
@@ -205,7 +211,7 @@
f_git.patch
series
- $ cat .hg/patches/f_git.patch
+ $ cat .hg/patches/f_git.patch | indexfilter
# HG changeset patch
# User test
# Date ?????????? ? (glob)
@@ -215,6 +221,7 @@
diff --git a/p b/p
new file mode 100644
+ index 000000000000..<hash>
--- /dev/null
+++ b/p
@@ -0,0 +1,1 @@
diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -811,6 +811,7 @@
diff --git a/subdir/f1 b/subdir/f1
old mode 100644
new mode 100755
+ index 38ec577f126b..3261adceb075
--- a/subdir/f1
+++ b/subdir/f1
@@ -1,2 +1,3 @@
@@ -845,6 +846,7 @@
summary: aa
diff --git a/subdir/f1 b/subdir/f1
+ index 3261adceb075..b429867550db
--- a/subdir/f1
+++ b/subdir/f1
@@ -1,3 +1,4 @@
@@ -885,6 +887,7 @@
diff --git a/subdir/f1 b/subdir/f1
old mode 100755
new mode 100644
+ index b429867550db..0b082130c20a
--- a/subdir/f1
+++ b/subdir/f1
@@ -2,3 +2,4 @@
@@ -1039,7 +1042,7 @@
Editing patch
$ cat > editor.sh << '__EOF__'
- > sed -e 7d -e '5s/^-/ /' "$1" > tmp
+ > sed -e 8d -e '6s/^-/ /' "$1" > tmp
> mv tmp "$1"
> __EOF__
$ cat > editedfile << '__EOF__'
diff --git a/tests/test-rename.t b/tests/test-rename.t
--- a/tests/test-rename.t
+++ b/tests/test-rename.t
@@ -581,8 +581,8 @@
rename from d1/b
rename to d1/a
diff --git a/d1/a b/d1/c
- copy from d1/a
- copy to d1/c
+ rename from d1/a
+ rename to d1/c
$ hg update -C
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
diff --git a/tests/test-symlinks.t b/tests/test-symlinks.t
--- a/tests/test-symlinks.t
+++ b/tests/test-symlinks.t
@@ -117,6 +117,7 @@
$ hg diff --git -r null:tip
diff --git a/a/b/c/demo b/a/b/c/demo
new file mode 120000
+ index 000000000000..494d85359345
--- /dev/null
+++ b/a/b/c/demo
@@ -0,0 +1,1 @@
@@ -133,6 +134,7 @@
$ hg diff --git -r 1:tip
diff --git a/a/b/c/demo b/a/b/c/demo
new file mode 120000
+ index 000000000000..621f4b7c8c91
--- /dev/null
+++ b/a/b/c/demo
@@ -0,0 +1,1 @@
More information about the Mercurial-devel
mailing list