mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-11-01 00:55:48 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aadc899982 | ||
|
|
4d38bff053 | ||
|
|
a8cd6a92b3 | ||
|
|
a08ad9d2b4 | ||
|
|
8c08b6de21 | ||
|
|
949345fb11 | ||
|
|
0d49f75131 | ||
|
|
7159e4a030 | ||
|
|
cdcd70b453 | ||
|
|
f5c38f3a59 | ||
|
|
3b11156e69 | ||
|
|
afc1f3a2c2 | ||
|
|
e596a5f457 | ||
|
|
ec654d4682 | ||
|
|
7913920a97 | ||
|
|
da60201ae3 | ||
|
|
704869df29 | ||
|
|
5769e965eb | ||
|
|
1ee28bd233 | ||
|
|
1796289df3 | ||
|
|
929ae262f5 | ||
|
|
4328aa1c19 |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/build/
|
||||||
|
/dist/
|
||||||
|
/git_remote_hg.egg-info/
|
||||||
31
Makefile
31
Makefile
@@ -3,7 +3,28 @@ prefix := $(HOME)
|
|||||||
bindir := $(prefix)/bin
|
bindir := $(prefix)/bin
|
||||||
mandir := $(prefix)/share/man/man1
|
mandir := $(prefix)/share/man/man1
|
||||||
|
|
||||||
all: doc
|
all: build doc
|
||||||
|
|
||||||
|
build:
|
||||||
|
if [ -n "$$PYTHON" ] && "$$PYTHON" -c 'import mercurial' 2> /dev/null ; then \
|
||||||
|
: Use chosen Python version ; \
|
||||||
|
elif python3 -c 'import mercurial' 2> /dev/null ; then \
|
||||||
|
PYTHON=python3 ; \
|
||||||
|
elif python2 -c 'import mercurial' 2> /dev/null ; then \
|
||||||
|
PYTHON=python2 ; \
|
||||||
|
elif python -c 'import mercurial' 2> /dev/null ; then \
|
||||||
|
PYTHON=python ; \
|
||||||
|
else ; \
|
||||||
|
echo 'Python with Mercurial not available' >&2 ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi ; \
|
||||||
|
mkdir -p bin ; \
|
||||||
|
for s in git-remote-hg git-hg-helper ; do \
|
||||||
|
printf "%s\n" "#!/usr/bin/env $$PYTHON" > "bin/$$s" ; \
|
||||||
|
tail -n +2 "./$$s" >> "bin/$$s" ; \
|
||||||
|
chmod 755 "bin/$$s" ; \
|
||||||
|
touch -r "./$$s" "bin/$$s" ; \
|
||||||
|
done
|
||||||
|
|
||||||
doc: doc/git-remote-hg.1
|
doc: doc/git-remote-hg.1
|
||||||
|
|
||||||
@@ -15,12 +36,14 @@ doc/git-remote-hg.1: doc/git-remote-hg.txt
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) doc/git-remote-hg.1
|
$(RM) doc/git-remote-hg.1
|
||||||
|
$(RM) -r bin/
|
||||||
|
|
||||||
D = $(DESTDIR)
|
D = $(DESTDIR)
|
||||||
|
|
||||||
install:
|
install: build
|
||||||
install -d -m 755 $(D)$(bindir)/
|
install -d -m 755 $(D)$(bindir)/
|
||||||
install -m 755 git-remote-hg $(D)$(bindir)/git-remote-hg
|
install -m 755 bin/git-remote-hg $(D)$(bindir)/git-remote-hg
|
||||||
|
install -m 755 bin/git-hg-helper $(D)$(bindir)/git-hg-helper
|
||||||
|
|
||||||
install-doc: doc
|
install-doc: doc
|
||||||
install -d -m 755 $(D)$(mandir)/
|
install -d -m 755 $(D)$(mandir)/
|
||||||
@@ -38,4 +61,4 @@ pypi-upload:
|
|||||||
pypi-test:
|
pypi-test:
|
||||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
||||||
|
|
||||||
.PHONY: all test install install-doc clean pypy pypy-upload
|
.PHONY: all build test install install-doc clean pypy pypy-upload
|
||||||
|
|||||||
@@ -193,7 +193,9 @@ def gitref(ref):
|
|||||||
# standard url percentage encoding with a (legacy) twist:
|
# standard url percentage encoding with a (legacy) twist:
|
||||||
# ' ' -> '___'
|
# ' ' -> '___'
|
||||||
# '___' also percentage encoded
|
# '___' also percentage encoded
|
||||||
return compat.urlquote(ref).replace(b'___', b'%5F%5F%5F').replace(b'%20', b'___')
|
# python 3.6 considers ~ reserved, whereas python 3.7 no longer
|
||||||
|
return compat.urlquote(ref).replace(b'___', b'%5F%5F%5F'). \
|
||||||
|
replace(b'%20', b'___').replace(b'~', b'%7E')
|
||||||
|
|
||||||
def check_version(*check):
|
def check_version(*check):
|
||||||
if not hg_version:
|
if not hg_version:
|
||||||
|
|||||||
7
setup.py
7
setup.py
@@ -1,12 +1,9 @@
|
|||||||
# git-remote-hg setuptools script
|
# git-remote-hg setuptools script
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# strip leading v
|
# strip leading v
|
||||||
version = 'v1.0.2'[1:]
|
version = 'v1.0.3.1'[1:]
|
||||||
|
|
||||||
# check for released version
|
# check for released version
|
||||||
assert (len(version) > 0)
|
assert (len(version) > 0)
|
||||||
@@ -25,6 +22,8 @@ CLASSIFIERS = [
|
|||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 2",
|
"Programming Language :: Python :: 2",
|
||||||
"Programming Language :: Python :: 2.7",
|
"Programming Language :: Python :: 2.7",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.6",
|
||||||
"License :: OSI Approved",
|
"License :: OSI Approved",
|
||||||
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
||||||
"Development Status :: 5 - Production/Stable",
|
"Development Status :: 5 - Production/Stable",
|
||||||
|
|||||||
@@ -13,13 +13,7 @@ test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/
|
|||||||
|
|
||||||
if ! test_have_prereq PYTHON
|
if ! test_have_prereq PYTHON
|
||||||
then
|
then
|
||||||
skip_all='skipping remote-hg tests; python not available'
|
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
skip_all='skipping remote-hg tests; mercurial not available'
|
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,7 @@ test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/
|
|||||||
|
|
||||||
if ! test_have_prereq PYTHON
|
if ! test_have_prereq PYTHON
|
||||||
then
|
then
|
||||||
skip_all='skipping remote-hg tests; python not available'
|
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
skip_all='skipping remote-hg tests; mercurial not available'
|
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -544,4 +538,4 @@ test_expect_success 'subcommand sub status' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|||||||
@@ -13,20 +13,14 @@ test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/
|
|||||||
|
|
||||||
if ! test_have_prereq PYTHON
|
if ! test_have_prereq PYTHON
|
||||||
then
|
then
|
||||||
skip_all='skipping remote-hg tests; python not available'
|
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
if "$PYTHON" -c 'import hggit' > /dev/null 2>&1
|
||||||
then
|
|
||||||
skip_all='skipping remote-hg tests; mercurial not available'
|
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if python -c 'import hggit' > /dev/null 2>&1
|
|
||||||
then
|
then
|
||||||
hggit=hggit
|
hggit=hggit
|
||||||
elif python -c 'import hgext.git' > /dev/null 2>&1
|
elif "$PYTHON" -c 'import hgext.git' > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
hggit=hgext.git
|
hggit=hgext.git
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -270,10 +270,10 @@ test_expect_success 'push with renamed executable preserves executable bit' '
|
|||||||
) &&
|
) &&
|
||||||
|
|
||||||
(
|
(
|
||||||
|
umask 0 &&
|
||||||
cd hgrepo &&
|
cd hgrepo &&
|
||||||
hg update &&
|
hg update &&
|
||||||
stat content2 >expected &&
|
stat content2 >expected &&
|
||||||
# umask mileage might vary
|
|
||||||
grep -- -r.xr.xr.x expected
|
grep -- -r.xr.xr.x expected
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|||||||
11
test/main.t
11
test/main.t
@@ -22,13 +22,7 @@ fi
|
|||||||
|
|
||||||
if ! test_have_prereq PYTHON
|
if ! test_have_prereq PYTHON
|
||||||
then
|
then
|
||||||
skip_all='skipping remote-hg tests; python not available'
|
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
skip_all='skipping remote-hg tests; mercurial not available'
|
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -803,7 +797,6 @@ test_expect_success 'remote big push force' '
|
|||||||
fi
|
fi
|
||||||
) &&
|
) &&
|
||||||
|
|
||||||
check_branch hgrepo default six &&
|
|
||||||
check_branch hgrepo good_branch eight &&
|
check_branch hgrepo good_branch eight &&
|
||||||
check_branch hgrepo bad_branch nine &&
|
check_branch hgrepo bad_branch nine &&
|
||||||
check_branch hgrepo new_branch ten &&
|
check_branch hgrepo new_branch ten &&
|
||||||
@@ -1093,7 +1086,7 @@ test_expect_success 'push bookmark without changesets' '
|
|||||||
check_bookmark hgrepo feature-a two
|
check_bookmark hgrepo feature-a two
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_unstable 'pull tags' '
|
test_expect_success 'pull tags' '
|
||||||
test_when_finished "rm -rf hgrepo gitrepo" &&
|
test_when_finished "rm -rf hgrepo gitrepo" &&
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -1,8 +1,60 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
. ./sharness.sh
|
if [ -z "$SHARNESS" ] ; then
|
||||||
|
for d in \
|
||||||
|
"." \
|
||||||
|
"$HOME/share/sharness" \
|
||||||
|
"/usr/local/share/sharness" \
|
||||||
|
"/usr/share/sharness"
|
||||||
|
do
|
||||||
|
f="$d/sharness.sh"
|
||||||
|
if [ -f "$f" ] ; then
|
||||||
|
SHARNESS="$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ -z "$SHARNESS" ] || [ ! -f "$SHARNESS" ] ; then
|
||||||
|
echo "sharness.sh not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
test_set_prereq PYTHON
|
# Prevent sharness from adding the source directory to PATH
|
||||||
|
# since the scripts use unversioned python for their shebang
|
||||||
|
# but tests should run under the python with mercurial support
|
||||||
|
# so create an empty directory and strip it from PATH afterwards
|
||||||
|
SHARNESS_BUILD_DIRECTORY="$(mktemp -d)"
|
||||||
|
. "$SHARNESS"
|
||||||
|
export PATH="${PATH#*:}"
|
||||||
|
rmdir "$SHARNESS_BUILD_DIRECTORY"
|
||||||
|
|
||||||
|
if [ -z "$TEST_INSTALLED_SCRIPTS" ] ; then
|
||||||
|
if [ -n "$PYTHON" ] && "$PYTHON" -c 'import mercurial' 2> /dev/null ; then
|
||||||
|
: Use chosen Python version
|
||||||
|
elif python3 -c 'import mercurial' 2> /dev/null ; then
|
||||||
|
PYTHON=python3
|
||||||
|
elif python2 -c 'import mercurial' 2> /dev/null ; then
|
||||||
|
PYTHON=python2
|
||||||
|
elif python -c 'import mercurial' 2> /dev/null ; then
|
||||||
|
PYTHON=python
|
||||||
|
fi
|
||||||
|
if [ -n "$PYTHON" ] ; then
|
||||||
|
test_set_prereq PYTHON
|
||||||
|
|
||||||
|
# Change shebang on a copy of scripts to chosen Python version
|
||||||
|
TEST_BIN="$SHARNESS_TRASH_DIRECTORY/bin"
|
||||||
|
mkdir -p "$TEST_BIN"
|
||||||
|
for s in git-remote-hg git-hg-helper ; do
|
||||||
|
printf "%s\n" "#!/usr/bin/env $PYTHON" > "$TEST_BIN/$s"
|
||||||
|
tail -n +2 "$SHARNESS_TEST_DIRECTORY/../$s" >> "$TEST_BIN/$s"
|
||||||
|
chmod u+x "$TEST_BIN/$s"
|
||||||
|
done
|
||||||
|
export PATH="$TEST_BIN${PATH:+:$PATH}"
|
||||||
|
unset TEST_BIN
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# The build/install process ensures Python is available
|
||||||
|
test_set_prereq PYTHON
|
||||||
|
fi
|
||||||
|
|
||||||
GIT_AUTHOR_EMAIL=author@example.com
|
GIT_AUTHOR_EMAIL=author@example.com
|
||||||
GIT_AUTHOR_NAME='A U Thor'
|
GIT_AUTHOR_NAME='A U Thor'
|
||||||
@@ -10,3 +62,6 @@ GIT_COMMITTER_EMAIL=committer@example.com
|
|||||||
GIT_COMMITTER_NAME='C O Mitter'
|
GIT_COMMITTER_NAME='C O Mitter'
|
||||||
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
|
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
|
||||||
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
|
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
|
||||||
|
# maintain backwards compatible default
|
||||||
|
# (as used in remote helper)
|
||||||
|
git config --global init.defaultBranch master
|
||||||
|
|||||||
@@ -20,11 +20,17 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
require 'tmpdir'
|
||||||
|
|
||||||
$tests = %w[main.t bidi.t hg-git.t]
|
$tests = %w[main.t bidi.t hg-git.t]
|
||||||
$workdir = "#{Dir.home}/.cache/git-remote-hg"
|
$workdir = "#{Dir.home}/.cache/git-remote-hg"
|
||||||
$builddir = "/tmp/git-remote-hg-build"
|
$builddir = Dir.mktmpdir("git-remote-hg-build-")
|
||||||
$testoutdir = "/tmp/git-remote-hg-tests"
|
$testoutdir = Dir.mktmpdir("git-remote-hg-tests-")
|
||||||
|
|
||||||
|
at_exit {
|
||||||
|
FileUtils.remove_entry($builddir)
|
||||||
|
FileUtils.remove_entry($testoutdir)
|
||||||
|
}
|
||||||
|
|
||||||
QUIET, LOW, HIGH = (1..3).to_a
|
QUIET, LOW, HIGH = (1..3).to_a
|
||||||
$verbosity = LOW
|
$verbosity = LOW
|
||||||
|
|||||||
Reference in New Issue
Block a user