mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
f97848cf4b
Summary: Fixing issue [[ http://www.facebook.com/groups/sourcecontrol/permalink/908533209196300/?comment_id=908544142528540&offset=0&total_comments=3 | here ]] Test Plan: $ hg-clone-fbsource --no-working-dir $ hg-new-workdir ~/fbsource/ ~/fbandroid/ expect hg not updating to tip Reviewers: quark, rmcelroy Reviewed By: rmcelroy Differential Revision: https://phabricator.fb.com/D2700764 Tasks: 9048802 Signature: t1:2700764:1448914720:1218c99891cdd4be40369626cfc7d0c9c41ba811
62 lines
1.6 KiB
Plaintext
Executable File
62 lines
1.6 KiB
Plaintext
Executable File
# Copyright (C) 2015 Facebook, Inc
|
|
# Maintained by Ryan McElroy <rm@fb.com>
|
|
#
|
|
# Distributed under the GNU General Public License, version 2.0.
|
|
#
|
|
#!/bin/bash -e
|
|
|
|
if [[ $# -ne 2 ]]; then
|
|
PROGNAME="$(basename $0)"
|
|
cat <<END
|
|
Usage: $PROGNAME <src> <dst>
|
|
|
|
This script enables the Mercurial share extension, shares a repository from
|
|
'src' to 'dst', and copies the .hg/hgrc configuration from 'src' to 'dst'.
|
|
This allows sharing repositories with non-standard configurations like we have
|
|
here at Facebook.
|
|
|
|
In the future, this functionality will probably be folded into the share
|
|
extension directly.
|
|
END
|
|
exit 1
|
|
fi
|
|
|
|
src="$1"
|
|
dst="$2"
|
|
|
|
hg --config "extensions.share=" share --noupdate --bookmarks "$src" "$dst"
|
|
|
|
echo "Setting up configuration..."
|
|
cp "$src/.hg/hgrc" "$dst/.hg/hgrc"
|
|
|
|
# Force share on in this repo, regardless of global setting.
|
|
# This ensures that bookmark shares will work
|
|
# (basic sharing works even without extension).
|
|
if [[ ! $(grep -q "^share=$" "$dst/.hg/hgrc") ]]; then
|
|
cat >> "$dst/.hg/hgrc" <<END
|
|
[extensions]
|
|
share=
|
|
END
|
|
fi
|
|
|
|
# For forward compatibility, write "bookmarks" into the "shared" file.
|
|
# See http://patchwork.serpentine.com/patch/7488/
|
|
echo "bookmarks" >> "$dst/.hg/shared"
|
|
|
|
# Copy over svn metadata since hgsvn and share are not aware of each other
|
|
if [[ -d $src/.hg/svn ]]; then
|
|
echo "Copying svn metadata..."
|
|
cp -R $src/.hg/svn $dst/.hg/
|
|
fi
|
|
|
|
if [[ -e $src/.hg/sparse ]]; then
|
|
echo "Copying sparse profile..."
|
|
cp $src/.hg/sparse $dst/.hg/
|
|
fi
|
|
|
|
echo "Updating new repository..."
|
|
hg --cwd "$dst" update $(hg --cwd "$src" log -r . -T '{node}')
|
|
|
|
echo "Set up new Mercurial Working Directory in '$dst' based on '$src'..."
|
|
|