mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-10-30 16:15:48 +01:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
|
||||
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 ; \
|
||||
fi ; \
|
||||
if [ -n "$$PYTHON" ] ; then \
|
||||
PYTHON=python ; \
|
||||
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
|
||||
|
||||
@@ -15,12 +36,14 @@ doc/git-remote-hg.1: doc/git-remote-hg.txt
|
||||
|
||||
clean:
|
||||
$(RM) doc/git-remote-hg.1
|
||||
$(RM) -r bin/
|
||||
|
||||
D = $(DESTDIR)
|
||||
|
||||
install:
|
||||
install: build
|
||||
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 -d -m 755 $(D)$(mandir)/
|
||||
@@ -38,4 +61,4 @@ pypi-upload:
|
||||
pypi-test:
|
||||
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:
|
||||
# ' ' -> '___'
|
||||
# '___' 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):
|
||||
if not hg_version:
|
||||
|
||||
7
setup.py
7
setup.py
@@ -1,12 +1,9 @@
|
||||
# git-remote-hg setuptools script
|
||||
|
||||
import setuptools
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
# strip leading v
|
||||
version = 'v1.0.2'[1:]
|
||||
version = 'v1.0.3'[1:]
|
||||
|
||||
# check for released version
|
||||
assert (len(version) > 0)
|
||||
@@ -25,6 +22,8 @@ CLASSIFIERS = [
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"License :: OSI Approved",
|
||||
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
|
||||
@@ -13,13 +13,7 @@ test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/
|
||||
|
||||
if ! test_have_prereq PYTHON
|
||||
then
|
||||
skip_all='skipping remote-hg tests; python not available'
|
||||
test_done
|
||||
fi
|
||||
|
||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
||||
then
|
||||
skip_all='skipping remote-hg tests; mercurial not available'
|
||||
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||
test_done
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,13 +13,7 @@ test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/
|
||||
|
||||
if ! test_have_prereq PYTHON
|
||||
then
|
||||
skip_all='skipping remote-hg tests; python not available'
|
||||
test_done
|
||||
fi
|
||||
|
||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
||||
then
|
||||
skip_all='skipping remote-hg tests; mercurial not available'
|
||||
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||
test_done
|
||||
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
|
||||
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
|
||||
fi
|
||||
|
||||
if python -c 'import hggit' > /dev/null 2>&1
|
||||
if "$PYTHON" -c 'import hggit' > /dev/null 2>&1
|
||||
then
|
||||
hggit=hggit
|
||||
elif python -c 'import hgext.git' > /dev/null 2>&1
|
||||
elif "$PYTHON" -c 'import hgext.git' > /dev/null 2>&1
|
||||
then
|
||||
hggit=hgext.git
|
||||
else
|
||||
|
||||
@@ -270,10 +270,10 @@ test_expect_success 'push with renamed executable preserves executable bit' '
|
||||
) &&
|
||||
|
||||
(
|
||||
umask 0 &&
|
||||
cd hgrepo &&
|
||||
hg update &&
|
||||
stat content2 >expected &&
|
||||
# umask mileage might vary
|
||||
grep -- -r.xr.xr.x expected
|
||||
)
|
||||
'
|
||||
|
||||
11
test/main.t
11
test/main.t
@@ -22,13 +22,7 @@ fi
|
||||
|
||||
if ! test_have_prereq PYTHON
|
||||
then
|
||||
skip_all='skipping remote-hg tests; python not available'
|
||||
test_done
|
||||
fi
|
||||
|
||||
if ! python -c 'import mercurial' > /dev/null 2>&1
|
||||
then
|
||||
skip_all='skipping remote-hg tests; mercurial not available'
|
||||
skip_all='skipping remote-hg tests; python with mercurial not available'
|
||||
test_done
|
||||
fi
|
||||
|
||||
@@ -803,7 +797,6 @@ test_expect_success 'remote big push force' '
|
||||
fi
|
||||
) &&
|
||||
|
||||
check_branch hgrepo default six &&
|
||||
check_branch hgrepo good_branch eight &&
|
||||
check_branch hgrepo bad_branch nine &&
|
||||
check_branch hgrepo new_branch ten &&
|
||||
@@ -1093,7 +1086,7 @@ test_expect_success 'push bookmark without changesets' '
|
||||
check_bookmark hgrepo feature-a two
|
||||
'
|
||||
|
||||
test_expect_unstable 'pull tags' '
|
||||
test_expect_success 'pull tags' '
|
||||
test_when_finished "rm -rf hgrepo gitrepo" &&
|
||||
|
||||
(
|
||||
|
||||
@@ -1,8 +1,55 @@
|
||||
#!/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 [ -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
|
||||
|
||||
GIT_AUTHOR_EMAIL=author@example.com
|
||||
GIT_AUTHOR_NAME='A U Thor'
|
||||
@@ -10,3 +57,6 @@ GIT_COMMITTER_EMAIL=committer@example.com
|
||||
GIT_COMMITTER_NAME='C O Mitter'
|
||||
export GIT_AUTHOR_EMAIL GIT_AUTHOR_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 'tmpdir'
|
||||
|
||||
$tests = %w[main.t bidi.t hg-git.t]
|
||||
$workdir = "#{Dir.home}/.cache/git-remote-hg"
|
||||
$builddir = "/tmp/git-remote-hg-build"
|
||||
$testoutdir = "/tmp/git-remote-hg-tests"
|
||||
$builddir = Dir.mktmpdir("git-remote-hg-build-")
|
||||
$testoutdir = Dir.mktmpdir("git-remote-hg-tests-")
|
||||
|
||||
at_exit {
|
||||
FileUtils.remove_entry($builddir)
|
||||
FileUtils.remove_entry($testoutdir)
|
||||
}
|
||||
|
||||
QUIET, LOW, HIGH = (1..3).to_a
|
||||
$verbosity = LOW
|
||||
|
||||
Reference in New Issue
Block a user