mirror of
https://github.com/frej/fast-export.git
synced 2026-02-28 07:10:42 +01:00
@@ -23,11 +23,11 @@ user_clean_re=re.compile(b'^["]([^"]+)["]$')
|
||||
|
||||
def set_default_branch(name):
|
||||
global cfg_master
|
||||
cfg_master = name.encode('utf8') if not isinstance(name, bytes) else name
|
||||
cfg_master = name.encode('utf8')
|
||||
|
||||
def set_origin_name(name):
|
||||
global origin_name
|
||||
origin_name = name
|
||||
origin_name = name.encode('utf8')
|
||||
|
||||
def setup_repo(url):
|
||||
try:
|
||||
|
||||
42
t/set_origin.expected
Normal file
42
t/set_origin.expected
Normal file
@@ -0,0 +1,42 @@
|
||||
blob
|
||||
mark :1
|
||||
data 5
|
||||
zero
|
||||
|
||||
reset refs/heads/prefix/master
|
||||
commit refs/heads/prefix/master
|
||||
mark :2
|
||||
author H G Wells <wells@example.com> 1679014800 +0000
|
||||
committer H G Wells <wells@example.com> 1679014800 +0000
|
||||
data 5
|
||||
zero
|
||||
M 100644 :1 content
|
||||
|
||||
blob
|
||||
mark :3
|
||||
data 8
|
||||
branch1
|
||||
|
||||
commit refs/heads/prefix/branch1
|
||||
mark :4
|
||||
author H G Wells <wells@example.com> 1679018400 +0000
|
||||
committer H G Wells <wells@example.com> 1679018400 +0000
|
||||
data 29
|
||||
Added file in branch branch1
|
||||
from :2
|
||||
M 100644 :3 b8486c4feca589a4237a1ee428322d7109ede12e
|
||||
|
||||
blob
|
||||
mark :5
|
||||
data 8
|
||||
branch2
|
||||
|
||||
commit refs/heads/prefix/branch2
|
||||
mark :6
|
||||
author H G Wells <wells@example.com> 1679022000 +0000
|
||||
committer H G Wells <wells@example.com> 1679022000 +0000
|
||||
data 29
|
||||
Added file in branch branch2
|
||||
from :4
|
||||
M 100644 :5 fe786baee0d76603092c25609f2967b9c28a2cf2
|
||||
|
||||
59
t/set_origin.t
Executable file
59
t/set_origin.t
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2023 Felipe Contreras
|
||||
# Copyright (c) 2025 Günther Nußmüller
|
||||
#
|
||||
|
||||
test_description='Set origin tests'
|
||||
|
||||
. "${SHARNESS_TEST_SRCDIR-$(dirname "$0")/sharness}"/sharness.sh || exit 1
|
||||
|
||||
check() {
|
||||
git -C "$1" fast-export --all > actual
|
||||
test_cmp "$SHARNESS_TEST_DIRECTORY"/set_origin.expected actual
|
||||
}
|
||||
|
||||
git_clone() {
|
||||
(
|
||||
git init -q "$2" &&
|
||||
cd "$2" &&
|
||||
git config core.ignoreCase false &&
|
||||
hg-fast-export.sh --repo "../$1" --origin "$3"
|
||||
)
|
||||
}
|
||||
|
||||
setup() {
|
||||
cat > "$HOME"/.hgrc <<-EOF
|
||||
[ui]
|
||||
username = H G Wells <wells@example.com>
|
||||
EOF
|
||||
}
|
||||
|
||||
make-branch() {
|
||||
hg branch "$1"
|
||||
FILE=$(echo "$1" | sha1sum | cut -d " " -f 1)
|
||||
echo "$1" > $FILE
|
||||
hg add $FILE
|
||||
hg commit -d "2023-03-17 $2:00Z" -m "Added file in branch $1"
|
||||
}
|
||||
|
||||
setup
|
||||
|
||||
test_expect_success 'basic' '
|
||||
test_when_finished "rm -rf hgrepo gitrepo" &&
|
||||
|
||||
(
|
||||
hg init hgrepo &&
|
||||
cd hgrepo &&
|
||||
echo zero > content &&
|
||||
hg add content &&
|
||||
hg commit -m zero -d "2023-03-17 01:00Z" &&
|
||||
make-branch branch1 02 &&
|
||||
make-branch branch2 03
|
||||
) &&
|
||||
|
||||
git_clone hgrepo gitrepo prefix &&
|
||||
check gitrepo
|
||||
'
|
||||
|
||||
test_done
|
||||
Reference in New Issue
Block a user