Mercurial > hg
view tests/pdiff @ 39849:d3d4b4b5f725
localrepo: support writing shared file (API)
Now that we can create a shared repository via creation options, we
can handle other special actions related to share at repo creation time
as well.
One of the things we do after creating a shared repository is write
out a .hg/shared file containing the list of additional things to
share. Of which only "bookmarks" is supported.
We add a creation option to hold the set of additional items to
share. If items are defined, we write out the .hg/shared file at
repo creation time.
As part of this, we no longer hold the repo lock when writing the
file. I'm pretty sure we don't care about the tiny race condition
window. I'm also pretty sure the reason we used the lock was because
the vfs auditor on the repo instance complained otherwise. Since the
repo creation code doesn't have an audited vfs, we don't need to
appease it.
Because we no longer need to tell the post share hook what items
are shared, the "bookmarks" argument to that function has been
dropped, incurring an API change.
Differential Revision: https://phab.mercurial-scm.org/D4708
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 19 Sep 2018 17:27:37 -0700 |
parents | a2b55ee62803 |
children |
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@" # in this case, files differ from each other return 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 # TODO: there is no portable way for current while-read based # implementation to return 1 at detecting changes. # # On bash and dash, assignment to variable inside while-block # doesn't affect outside, because inside while-block is executed # in sub-shell. BTW, it affects outside while-block on ksh (as sh # on Solaris). else filediff "$1" "$2" fi