Mercurial > hg
view tests/pdiff @ 28488:437c32dcec7d
context: use changelogrevision
Upcoming patches will make the changelogrevision object perform
lazy parsing. Let's switch to it.
Because we're switching from a tuple to an object, everthing that
accesses the internal cached attribute needs to be updated to access
via attributes. A nice side-effect is this makes the code easier to
read!
Surprisingly, this appears to make revsets accessing this data
slightly faster (values are before series, p1, this patch):
author(mpm)
0.896565
0.929984
0.914234
desc(bug)
0.887169
0.935642
0.921073
date(2015)
0.878797
0.908094
0.891980
extra(rebase_source)
0.865446
0.922624
0.912514
author(mpm) or author(greg)
1.801832
1.902112
1.860402
author(mpm) or desc(bug)
1.812438
1.860977
1.844850
date(2015) or branch(default)
0.968276
1.005824
0.994673
author(mpm) or desc(bug) or date(2015) or extra(rebase_source)
3.656193
3.743381
3.721032
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 06 Mar 2016 13:26:37 -0800 |
parents | 869e65e68aee |
children | a2b55ee62803 |
line wrap: on
line source
#!/bin/sh # Script to get stable diff output on any platform. # # Output of this script is almost equivalent to GNU diff with "-Nru". # # Use this script as "hg pdiff" via extdiff extension with preparation # below in test scripts: # # $ cat >> $HGRCPATH <<EOF # > [extdiff] # > pdiff = sh "$RUNTESTDIR/pdiff" # > EOF filediff(){ # USAGE: filediff file1 file2 [header] # compare with /dev/null if file doesn't exist (as "-N" option) file1="$1" if test ! -f "$file1"; then file1=/dev/null fi file2="$2" if test ! -f "$file2"; then file2=/dev/null fi if cmp -s "$file1" "$file2" 2> /dev/null; then # Return immediately, because comparison isn't needed. This # also avoids redundant message of diff like "No differences # encountered" (on Solaris) return fi if test -n "$3"; then # show header only in recursive case echo "$3" fi # replace "/dev/null" by corresponded filename (as "-N" option) diff -u "$file1" "$file2" | sed "s@^--- /dev/null\(.*\)\$@--- $1\1@" | sed "s@^\+\+\+ /dev/null\(.*\)\$@+++ $2\1@" } if test -d "$1" -o -d "$2"; then # ensure comparison in dictionary order ( if test -d "$1"; then (cd "$1" && find . -type f); fi if test -d "$2"; then (cd "$2" && find . -type f); fi ) | sed 's@^\./@@g' | sort | uniq | while read file; do filediff "$1/$file" "$2/$file" "diff -Nru $1/$file $2/$file" done else filediff "$1" "$2" fi