mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2026-05-07 01:56:27 +02:00
Merge commit 'b8b9a2f571c322bb3fe8a19c102a0f75fe9f3a9a' into felipec
These changes can be merged with limited to no conflict resolution.
This commit is contained in:
18
.github/workflows/main.yml
vendored
18
.github/workflows/main.yml
vendored
@@ -21,3 +21,21 @@ jobs:
|
||||
run:
|
||||
pip install mercurial==${{ matrix.hg }}
|
||||
- run: make test
|
||||
test-windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- uses: actions/cache@v3
|
||||
id: cache-pip
|
||||
with:
|
||||
path: ~/appdata/local/pip/cache
|
||||
key: pip-windows
|
||||
- name: Install hg
|
||||
run:
|
||||
pip install mercurial
|
||||
- name: Run all tests
|
||||
run: |
|
||||
make SHELL='C:/Program Files/Git/usr/bin/bash' -C test
|
||||
|
||||
@@ -240,21 +240,11 @@ def get_rev_hg(commit):
|
||||
|
||||
class Marks:
|
||||
|
||||
def __init__(self, path, repo):
|
||||
def __init__(self, path, _repo=None):
|
||||
self.path = path
|
||||
self.repo = repo
|
||||
self.clear()
|
||||
self.load()
|
||||
|
||||
if self.version < VERSION:
|
||||
if self.version == 1:
|
||||
self.upgrade_one()
|
||||
|
||||
# upgraded?
|
||||
if self.version < VERSION:
|
||||
self.clear()
|
||||
self.version = VERSION
|
||||
|
||||
def clear(self):
|
||||
self.tips = {}
|
||||
self.marks = {}
|
||||
@@ -276,20 +266,12 @@ class Marks:
|
||||
self.tips = []
|
||||
self.marks = marks
|
||||
self.last_mark = tmp['last-mark']
|
||||
self.version = tmp.get('version', 1)
|
||||
self.version = tmp['version']
|
||||
self.last_note = 0
|
||||
|
||||
for rev, mark in compat.iteritems(self.marks):
|
||||
self.rev_marks[mark] = rev
|
||||
|
||||
def upgrade_one(self):
|
||||
def get_id(rev):
|
||||
return hghex(self.repo.changelog.node(int(rev)))
|
||||
self.tips = dict((name, get_id(rev)) for name, rev in compat.iteritems(self.tips))
|
||||
self.marks = dict((get_id(rev), mark) for rev, mark in compat.iteritems(self.marks))
|
||||
self.rev_marks = dict((mark, get_id(rev)) for mark, rev in compat.iteritems(self.rev_marks))
|
||||
self.version = 2
|
||||
|
||||
def dict(self):
|
||||
return { 'tips': self.tips, 'marks': self.marks,
|
||||
'last-mark': self.last_mark, 'version': self.version,
|
||||
@@ -585,18 +567,6 @@ def get_repo(url, alias):
|
||||
else:
|
||||
shared_path = os.path.join(gitdir, b'hg')
|
||||
|
||||
# check and upgrade old organization
|
||||
hg_path = os.path.join(shared_path, b'.hg')
|
||||
if os.path.exists(shared_path) and not os.path.exists(hg_path):
|
||||
repos = os.listdir(shared_path)
|
||||
for x in repos:
|
||||
local_hg = os.path.join(shared_path, x, b'clone', b'.hg')
|
||||
if not os.path.exists(local_hg):
|
||||
continue
|
||||
if not os.path.exists(hg_path):
|
||||
shutil.move(local_hg, hg_path)
|
||||
shutil.rmtree(os.path.join(shared_path, x, b'clone'))
|
||||
|
||||
# setup shared repo (if not there)
|
||||
try:
|
||||
hg.peer(myui, {}, shared_path, create=True)
|
||||
@@ -607,11 +577,16 @@ def get_repo(url, alias):
|
||||
os.makedirs(dirname)
|
||||
|
||||
local_path = os.path.join(dirname, b'clone')
|
||||
if not os.path.exists(local_path):
|
||||
hg.share(myui, shared_path, local_path, update=False)
|
||||
if check_version(4, 2):
|
||||
if not os.path.exists(local_path):
|
||||
hg.share(myui, shared_path, local_path, update=False, relative=True)
|
||||
else:
|
||||
# make sure the shared path is always up-to-date
|
||||
util.writefile(os.path.join(local_path, b'.hg', b'sharedpath'), hg_path)
|
||||
if not os.path.exists(local_path):
|
||||
hg.share(myui, shared_path, local_path, update=False)
|
||||
else:
|
||||
# make sure the shared path is always up-to-date
|
||||
hg_path = os.path.join(shared_path, b'.hg')
|
||||
util.writefile(os.path.join(local_path, b'.hg', b'sharedpath'), hg_path)
|
||||
|
||||
repo = hg.repository(myui, local_path)
|
||||
try:
|
||||
@@ -1932,7 +1907,7 @@ def main(args):
|
||||
fix_path(alias, peer or repo, url)
|
||||
|
||||
marks_path = os.path.join(marksdir, b'marks-hg')
|
||||
marks = Marks(marks_path, repo)
|
||||
marks = Marks(marks_path)
|
||||
|
||||
if sys.platform == 'win32':
|
||||
import msvcrt
|
||||
|
||||
@@ -116,8 +116,10 @@ setup
|
||||
eval "old_$(declare -f test_expect_success)"
|
||||
|
||||
test_expect_success () {
|
||||
test_id="$1" &&
|
||||
old_test_expect_success "$1" "
|
||||
local req
|
||||
test "$#" = 3 && { req=$1; shift; } || req=
|
||||
test_id="$1"
|
||||
old_test_expect_success "$req" "$1" "
|
||||
test_when_finished \"rm -rf gitrepo* hgrepo*\" && $2"
|
||||
}
|
||||
|
||||
@@ -135,7 +137,7 @@ test_expect_success 'rename' '
|
||||
cmp_hg_to_git_log_hgrepo1
|
||||
'
|
||||
|
||||
test_expect_success 'executable bit' '
|
||||
test_expect_success !WIN 'executable bit' '
|
||||
(
|
||||
git init -q gitrepo &&
|
||||
cd gitrepo &&
|
||||
@@ -154,7 +156,7 @@ test_expect_success 'executable bit' '
|
||||
cmp_hg_to_git_manifest "hg manifest -v -r -1; hg manifest -v"
|
||||
'
|
||||
|
||||
test_expect_success 'symlink' '
|
||||
test_expect_success !WIN 'symlink' '
|
||||
(
|
||||
git init -q gitrepo &&
|
||||
cd gitrepo &&
|
||||
|
||||
@@ -506,7 +506,7 @@ else
|
||||
test_expect_failure "$testcopyrenamedesc" "$testcopyrename"
|
||||
fi
|
||||
|
||||
test_expect_success 'fetch special filenames' '
|
||||
test_expect_success !WIN 'fetch special filenames' '
|
||||
test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" &&
|
||||
|
||||
LC_ALL=en_US.UTF-8
|
||||
|
||||
@@ -64,7 +64,13 @@ 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
|
||||
git config --global protocol.file.allow always
|
||||
|
||||
if [[ $(uname -s) = MSYS* ]]; then
|
||||
test_set_prereq WIN
|
||||
export TEST_CMP='diff --strip-trailing-cr -u'
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user