* [PATCH] mergetools: Simplify how we handle "vim" and "defaults"
From: David Aguilar @ 2013-01-26 6:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, John Keeping
Remove the exceptions for "vim" and "defaults" in the mergetool library
so that every filename in mergetools/ matches 1:1 with the name of a
valid built-in tool.
Make common functions available in $MERGE_TOOLS_DIR/include/.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
This should make things ok on platforms where we don't have symlinks.
Makefile | 2 +-
git-mergetool--lib.sh | 41 +++++++++++-----------------
mergetools/gvimdiff | 1 +
mergetools/gvimdiff2 | 1 +
mergetools/{defaults => include/defaults.sh} | 0
mergetools/{vim => include/vim.sh} | 0
mergetools/vimdiff | 1 +
mergetools/vimdiff2 | 1 +
8 files changed, 21 insertions(+), 26 deletions(-)
create mode 100644 mergetools/gvimdiff
create mode 100644 mergetools/gvimdiff2
rename mergetools/{defaults => include/defaults.sh} (100%)
rename mergetools/{vim => include/vim.sh} (100%)
create mode 100644 mergetools/vimdiff
create mode 100644 mergetools/vimdiff2
diff --git a/Makefile b/Makefile
index f69979e..3bc6eb5 100644
--- a/Makefile
+++ b/Makefile
@@ -2724,7 +2724,7 @@ install: all
$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
- $(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
+ cp -R mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
ifndef NO_GETTEXT
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
(cd po/build/locale && $(TAR) cf - .) | \
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index aa38bd1..c866ed8 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -1,5 +1,7 @@
#!/bin/sh
# git-mergetool--lib is a library for common merge tool functions
+MERGE_TOOLS_DIR="$(git --exec-path)/mergetools"
+
diff_mode() {
test "$TOOL_MODE" = diff
}
@@ -44,25 +46,14 @@ valid_tool () {
}
setup_tool () {
- case "$1" in
- vim*|gvim*)
- tool=vim
- ;;
- *)
- tool="$1"
- ;;
- esac
- mergetools="$(git --exec-path)/mergetools"
+ tool="$1"
- # Load the default definitions
- . "$mergetools/defaults"
- if ! test -f "$mergetools/$tool"
+ if ! test -f "$MERGE_TOOLS_DIR/$tool"
then
return 1
fi
-
- # Load the redefined functions
- . "$mergetools/$tool"
+ . "$MERGE_TOOLS_DIR/include/defaults.sh"
+ . "$MERGE_TOOLS_DIR/$tool"
if merge_mode && ! can_merge
then
@@ -99,7 +90,7 @@ run_merge_tool () {
base_present="$2"
status=0
- # Bring tool-specific functions into scope
+ # Bring tool specific functions into scope
setup_tool "$1"
if merge_mode
@@ -177,18 +168,17 @@ list_merge_tool_candidates () {
show_tool_help () {
unavailable= available= LF='
'
-
- scriptlets="$(git --exec-path)"/mergetools
- for i in "$scriptlets"/*
+ for i in "$MERGE_TOOLS_DIR"/*
do
- . "$scriptlets"/defaults
- . "$i"
-
- tool="$(basename "$i")"
- if test "$tool" = "defaults"
+ if test -d "$i"
then
continue
- elif merge_mode && ! can_merge
+ fi
+
+ . "$MERGE_TOOLS_DIR"/include/defaults.sh
+ . "$i"
+
+ if merge_mode && ! can_merge
then
continue
elif diff_mode && ! can_diff
@@ -196,6 +186,7 @@ show_tool_help () {
continue
fi
+ tool=$(basename "$i")
merge_tool_path=$(translate_merge_tool_path "$tool")
if type "$merge_tool_path" >/dev/null 2>&1
then
diff --git a/mergetools/gvimdiff b/mergetools/gvimdiff
new file mode 100644
index 0000000..f5890b1
--- /dev/null
+++ b/mergetools/gvimdiff
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/include/vim.sh"
diff --git a/mergetools/gvimdiff2 b/mergetools/gvimdiff2
new file mode 100644
index 0000000..f5890b1
--- /dev/null
+++ b/mergetools/gvimdiff2
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/include/vim.sh"
diff --git a/mergetools/defaults b/mergetools/include/defaults.sh
similarity index 100%
rename from mergetools/defaults
rename to mergetools/include/defaults.sh
diff --git a/mergetools/vim b/mergetools/include/vim.sh
similarity index 100%
rename from mergetools/vim
rename to mergetools/include/vim.sh
diff --git a/mergetools/vimdiff b/mergetools/vimdiff
new file mode 100644
index 0000000..f5890b1
--- /dev/null
+++ b/mergetools/vimdiff
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/include/vim.sh"
diff --git a/mergetools/vimdiff2 b/mergetools/vimdiff2
new file mode 100644
index 0000000..f5890b1
--- /dev/null
+++ b/mergetools/vimdiff2
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/include/vim.sh"
--
1.8.0.6.ge6f188f.dirty
^ permalink raw reply related
* Re: [PATCH v2 1/3] branch: reject -D/-d without branch name
From: Duy Nguyen @ 2013-01-26 3:12 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Matthieu Moy
In-Reply-To: <7vham53x01.fsf@alter.siamese.dyndns.org>
On Sat, Jan 26, 2013 at 2:04 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> ---
>> builtin/branch.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> Forgot to sign-off?
Yes
> Is this a real problem?
Yes. My thoughts yesterday when I happened to type "git branch -D":
"Wait, I just entered a delete command without a branch name. It did
not report anything, which in UNIX world usually means successful
operation. _What_ did it delete??"
I knew this code so I just went check. If I did not know, I might as
well list all branches I had and see if something was missing. A short
message would have saved me the trouble.
> I do not see it particularly wrong to succeed after deleting 0 or
> more given branch names.
--
Duy
^ permalink raw reply
* [PATCH 2/2] mergetools: Make tortoisemerge work with
From: Sven Strickroth @ 2013-01-26 1:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, David Aguilar, Sebastian Schuberth, Jeff King
In-Reply-To: <7v622l5d87.fsf@alter.siamese.dyndns.org>
tortoisegitmerge and filesnames with space
The tortoisemerge mergetool does not work with filenames which have
a space in it. Fixing this required changes in git and also in
TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.
TortoiseGitMerge now separates cli parameter key-values by space instead
of colons as TortoiseSVN TortoiseMerge does and supports filesnames
with spaces in it this way now.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Reported-by: Sebastian Schuberth <sschuberth@gmail.com>
---
mergetools/tortoisemerge | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
index 8476afa..2f98829 100644
--- a/mergetools/tortoisemerge
+++ b/mergetools/tortoisemerge
@@ -6,9 +6,17 @@ merge_cmd () {
if $base_present
then
touch "$BACKUP"
- "$merge_tool_path" \
- -base:"$BASE" -mine:"$LOCAL" \
- -theirs:"$REMOTE" -merged:"$MERGED"
+ basename="$(basename "$merge_tool_path" .exe)"
+ if test "$basename" = "tortoisegitmerge"
+ then
+ "$merge_tool_path" \
+ -base "$BASE" -mine "$LOCAL" \
+ -theirs "$REMOTE" -merged "$MERGED"
+ else
+ "$merge_tool_path" \
+ -base:"$BASE" -mine:"$LOCAL" \
+ -theirs:"$REMOTE" -merged:"$MERGED"
+ fi
check_unchanged
else
echo "$merge_tool_path cannot be used without a base" 1>&2
--
Best regards,
Sven Strickroth
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related
* [PATCH 1/2] mergetools: Added support for TortoiseGitMerge
From: Sven Strickroth @ 2013-01-26 1:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, David Aguilar, Sebastian Schuberth, Jeff King
In-Reply-To: <7v622l5d87.fsf@alter.siamese.dyndns.org>
The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe
(starting with 1.8.0) in order to make clear that this one has special
support for git and prevent confusion with the TortoiseSVN TortoiseMerge
version.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
mergetools/tortoisemerge | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
index ed7db49..8476afa 100644
--- a/mergetools/tortoisemerge
+++ b/mergetools/tortoisemerge
@@ -11,7 +11,16 @@ merge_cmd () {
-theirs:"$REMOTE" -merged:"$MERGED"
check_unchanged
else
- echo "TortoiseMerge cannot be used without a base" 1>&2
+ echo "$merge_tool_path cannot be used without a base" 1>&2
return 1
fi
}
+
+translate_merge_tool_path() {
+ if type tortoisegitmerge >/dev/null 2>/dev/null
+ then
+ echo tortoisegitmerge
+ else
+ echo tortoisemerge
+ fi
+}
--
Best regards,
Sven Strickroth
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related
* Re: [PATCH] mergetools: Enhance tortoisemerge to work with
From: Sven Strickroth @ 2013-01-26 1:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, David Aguilar, Sebastian Schuberth, Jeff King
In-Reply-To: <7v622l5d87.fsf@alter.siamese.dyndns.org>
The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe
(starting with 1.8.0) in order to make clear that this one has special
support for git and prevent confusion with the TortoiseSVN TortoiseMerge
version.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
mergetools/tortoisemerge | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
index ed7db49..8476afa 100644
--- a/mergetools/tortoisemerge
+++ b/mergetools/tortoisemerge
@@ -11,7 +11,16 @@ merge_cmd () {
-theirs:"$REMOTE" -merged:"$MERGED"
check_unchanged
else
- echo "TortoiseMerge cannot be used without a base" 1>&2
+ echo "$merge_tool_path cannot be used without a base" 1>&2
return 1
fi
}
+
+translate_merge_tool_path() {
+ if type tortoisegitmerge >/dev/null 2>/dev/null
+ then
+ echo tortoisegitmerge
+ else
+ echo tortoisemerge
+ fi
+}
--
Best regards,
Sven Strickroth
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related
* [PATCH/RFC] mingw: rename WIN32 cpp macro to NATIVE_WINDOWS
From: Jonathan Nieder @ 2013-01-26 1:03 UTC (permalink / raw)
To: Eric Blake
Cc: Junio C Hamano, Mark Levedahl, Ramsay Jones, Alex Riesen,
Jason Pyeron, git, Torsten Bögershausen,
Stephen & Linda Smith
In-Reply-To: <51032481.4030707@redhat.com>
Throughout git, it is assumed that the WIN32 preprocessor symbol is
defined on native Windows setups (mingw and msvc) and not on Cygwin.
On Cygwin, most of the time git can pretend this is just another Unix
machine, and Windows-specific magic is generally counterproductive.
Unfortunately Cygwin *does* define the WIN32 symbol in some headers.
Best to rely on a new git-specific symbol NATIVE_WINDOWS instead,
defined as follows:
#if defined(WIN32) && !defined(__CYGWIN__)
# define NATIVE_WINDOWS
#endif
After this change, it should be possible to drop the
CYGWIN_V15_WIN32API setting without any negative effect.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Eric Blake wrote:
> Which is why other projects, like gnulib, have
>
> # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
>
> all over the place.
So, how about this?
Completely untested.
abspath.c | 2 +-
compat/terminal.c | 4 ++--
compat/win32.h | 2 +-
diff-no-index.c | 2 +-
git-compat-util.h | 3 ++-
help.c | 2 +-
run-command.c | 10 +++++-----
test-chmtime.c | 2 +-
thread-utils.c | 2 +-
9 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/abspath.c b/abspath.c
index 40cdc462..c7d5458e 100644
--- a/abspath.c
+++ b/abspath.c
@@ -216,7 +216,7 @@ const char *absolute_path(const char *path)
const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
{
static char path[PATH_MAX];
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
if (!pfx_len || is_absolute_path(arg))
return arg;
memcpy(path, pfx, pfx_len);
diff --git a/compat/terminal.c b/compat/terminal.c
index 9b5e3d1b..136e4a74 100644
--- a/compat/terminal.c
+++ b/compat/terminal.c
@@ -3,7 +3,7 @@
#include "sigchain.h"
#include "strbuf.h"
-#if defined(HAVE_DEV_TTY) || defined(WIN32)
+#if defined(HAVE_DEV_TTY) || defined(WINDOWS_NATIVE)
static void restore_term(void);
@@ -53,7 +53,7 @@ error:
return -1;
}
-#elif defined(WIN32)
+#elif defined(WINDOWS_NATIVE)
#define INPUT_PATH "CONIN$"
#define OUTPUT_PATH "CONOUT$"
diff --git a/compat/win32.h b/compat/win32.h
index 8ce91048..31dd30f7 100644
--- a/compat/win32.h
+++ b/compat/win32.h
@@ -2,7 +2,7 @@
#define WIN32_H
/* common Win32 functions for MinGW and Cygwin */
-#ifndef WIN32 /* Not defined by Cygwin */
+#ifndef WINDOWS_NATIVE /* Not defined for Cygwin */
#include <windows.h>
#endif
diff --git a/diff-no-index.c b/diff-no-index.c
index 74da6593..a0bc9c50 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -45,7 +45,7 @@ static int get_mode(const char *path, int *mode)
if (!path || !strcmp(path, "/dev/null"))
*mode = 0;
-#ifdef _WIN32
+#ifdef WINDOWS_NATIVE
else if (!strcasecmp(path, "nul"))
*mode = 0;
#endif
diff --git a/git-compat-util.h b/git-compat-util.h
index e5a4b745..ebbdff53 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -85,10 +85,11 @@
#define _NETBSD_SOURCE 1
#define _SGI_SOURCE 1
-#ifdef WIN32 /* Both MinGW and MSVC */
+#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
#include <winsock2.h>
#include <windows.h>
+#define WINDOWS_NATIVE
#endif
#include <unistd.h>
diff --git a/help.c b/help.c
index 2a42ec6d..cc1e63f7 100644
--- a/help.c
+++ b/help.c
@@ -106,7 +106,7 @@ static int is_executable(const char *name)
!S_ISREG(st.st_mode))
return 0;
-#if defined(WIN32) || defined(__CYGWIN__)
+#if defined(WINDOWS_NATIVE) || defined(__CYGWIN__)
#if defined(__CYGWIN__)
if ((st.st_mode & S_IXUSR) == 0)
#endif
diff --git a/run-command.c b/run-command.c
index 04712191..04ac6181 100644
--- a/run-command.c
+++ b/run-command.c
@@ -72,7 +72,7 @@ static inline void close_pair(int fd[2])
close(fd[1]);
}
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
static inline void dup_devnull(int to)
{
int fd = open("/dev/null", O_RDWR);
@@ -159,7 +159,7 @@ static const char **prepare_shell_cmd(const char **argv)
die("BUG: shell command is empty");
if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
nargv[nargc++] = SHELL_PATH;
#else
nargv[nargc++] = "sh";
@@ -182,7 +182,7 @@ static const char **prepare_shell_cmd(const char **argv)
return nargv;
}
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
static int execv_shell_cmd(const char **argv)
{
const char **nargv = prepare_shell_cmd(argv);
@@ -193,7 +193,7 @@ static int execv_shell_cmd(const char **argv)
}
#endif
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
static int child_err = 2;
static int child_notifier = -1;
@@ -330,7 +330,7 @@ fail_pipe:
trace_argv_printf(cmd->argv, "trace: run_command:");
fflush(NULL);
-#ifndef WIN32
+#ifndef WINDOWS_NATIVE
{
int notify_pipe[2];
if (pipe(notify_pipe))
diff --git a/test-chmtime.c b/test-chmtime.c
index 92713d16..803b6055 100644
--- a/test-chmtime.c
+++ b/test-chmtime.c
@@ -87,7 +87,7 @@ int main(int argc, const char *argv[])
return -1;
}
-#ifdef WIN32
+#ifdef WINDOWS_NATIVE
if (!(sb.st_mode & S_IWUSR) &&
chmod(argv[i], sb.st_mode | S_IWUSR)) {
fprintf(stderr, "Could not make user-writable %s: %s",
diff --git a/thread-utils.c b/thread-utils.c
index 7f4b76a9..4c4cf2fa 100644
--- a/thread-utils.c
+++ b/thread-utils.c
@@ -24,7 +24,7 @@ int online_cpus(void)
long ncpus;
#endif
-#ifdef _WIN32
+#ifdef WINDOWS_NATIVE
SYSTEM_INFO info;
GetSystemInfo(&info);
--
1.8.1.1
^ permalink raw reply related
* Re: [PATCH] mergetools: Enhance tortoisemerge to work with
From: Sven Strickroth @ 2013-01-26 0:58 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, David Aguilar, Sebastian Schuberth, Jeff King
In-Reply-To: <7v622l5d87.fsf@alter.siamese.dyndns.org>
Am 25.01.2013 19:28 schrieb Junio C Hamano:> Sven Strickroth
<sven.strickroth@tu-clausthal.de> writes:
>
>> TortoiseGitMerge and filenames with spaces
>
> ??? ECANNOTPARSE.
>
> ... ah, wait. Is this a broken-off tail of your subject line?
Yes.
>> + touch "$BACKUP"
>> + basename="$(basename "$merge_tool_path" .exe)"
>> + if test "$basename" = "tortoisegitmerge"
>> + then
>> + "$merge_tool_path" \
>> + -base "$BASE" -mine "$LOCAL" \
>> + -theirs "$REMOTE" -merged "$MERGED"
>> + else
>> + "$merge_tool_path" \
>> + -base:"$BASE" -mine:"$LOCAL" \
>> + -theirs:"$REMOTE" -merged:"$MERGED"
>
> Hmph.
>
> How was the support for "names with spaces" added in this new code?
> I do not spot what is different between this "else" clause and the
> original body of the merge_cmd (which only supported tortoisemerge).
>
> They seem to be doing exactly the same thing.
Erhm, no. As already stated and also mentioned in the commit log:
TortoiseMerge has cli parameter key-values separated by colons,
TortoiseGitMerge has key-values separated by spaces.
--
Best regards,
Sven Strickroth
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply
* [PATCH v2 1/2] t9901-git-web--browse.sh: Use "write_script" helper
From: Alexey Shumkin @ 2013-01-26 0:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Alexey Shumkin, git
In-Reply-To: <cover.1359160531.git.Alex.Crezoff@gmail.com>
Use "write_script" helper as suggested by Junio C Hamano.
Also, replace `pwd` with $(pwd) call convention.
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
---
t/t9901-git-web--browse.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/t/t9901-git-web--browse.sh b/t/t9901-git-web--browse.sh
index b0a6bad..b0dabf7 100755
--- a/t/t9901-git-web--browse.sh
+++ b/t/t9901-git-web--browse.sh
@@ -38,12 +38,10 @@ test_expect_success \
test_expect_success \
'browser paths are properly quoted' '
echo fake: http://example.com/foo >expect &&
- cat >"fake browser" <<-\EOF &&
- #!/bin/sh
+ write_script "fake browser" <<-\EOF &&
echo fake: "$@"
EOF
- chmod +x "fake browser" &&
- git config browser.w3m.path "`pwd`/fake browser" &&
+ git config browser.w3m.path "$(pwd)/fake browser" &&
test_web_browse w3m http://example.com/foo
'
--
1.8.1.1.10.g71fa0b7
^ permalink raw reply related
* [PATCH v2 2/2] git-web--browser: avoid errors in terminal when running Firefox on Windows
From: Alexey Shumkin @ 2013-01-26 0:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Alexey Shumkin, git
In-Reply-To: <cover.1359160531.git.Alex.Crezoff@gmail.com>
Firefox on Windows by default is placed in "C:\Program Files\Mozilla Firefox"
folder, i.e. its path contains spaces. Before running this browser "git-web--browse"
tests version of Firefox to decide whether to use "-new-tab" option or not.
Quote browser path to avoid error during this test.
Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
---
git-web--browse.sh | 2 +-
t/t9901-git-web--browse.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1e82726..f96e5bd 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -149,7 +149,7 @@ fi
case "$browser" in
firefox|iceweasel|seamonkey|iceape)
# Check version because firefox < 2.0 does not support "-new-tab".
- vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
+ vers=$(expr "$("$browser_path" -version)" : '.* \([0-9][0-9]*\)\..*')
NEWTAB='-new-tab'
test "$vers" -lt 2 && NEWTAB=''
"$browser_path" $NEWTAB "$@" &
diff --git a/t/t9901-git-web--browse.sh b/t/t9901-git-web--browse.sh
index b0dabf7..c1ee813 100755
--- a/t/t9901-git-web--browse.sh
+++ b/t/t9901-git-web--browse.sh
@@ -8,8 +8,23 @@ This test checks that git web--browse can handle various valid URLs.'
. ./test-lib.sh
test_web_browse () {
- # browser=$1 url=$2
+ # browser=$1 url=$2 sleep_timeout=$3
+ sleep_timeout="$3"
+ rm -f fake_browser_ran &&
git web--browse --browser="$1" "$2" >actual &&
+ # if $3 is set
+ # as far as Firefox is run in background (it is run with &)
+ # we trying to avoid race condition
+ # by waiting for "$sleep_timeout" seconds of timeout for 'fake_browser_ran' file appearance
+ if test -n "$sleep_timeout"
+ then
+ for timeout in $(test_seq $sleep_timeout)
+ do
+ test -f fake_browser_ran && break
+ sleep 1
+ done
+ test $timeout -ne $sleep_timeout
+ fi &&
tr -d '\015' <actual >text &&
test_cmp expect text
}
@@ -46,6 +61,42 @@ test_expect_success \
'
test_expect_success \
+ 'Paths are properly quoted for Firefox. Version older then v2.0' '
+ echo "fake: http://example.com/foo" >expect &&
+ write_script "fake browser" <<-\EOF &&
+
+ if test "$1" = "-version"; then
+ echo "Fake Firefox browser version 1.2.3"
+ else
+ # Firefox (in contrast to w3m) is run in background (with &)
+ # so redirect output to "actual"
+ echo "fake: ""$@" >actual
+ fi
+ : >fake_browser_ran
+ EOF
+ git config browser.firefox.path "$(pwd)/fake browser" &&
+ test_web_browse firefox http://example.com/foo 5
+'
+
+test_expect_success \
+ 'Paths are properly quoted for Firefox. Version v2.0 and above' '
+ echo "fake: -new-tab http://example.com/foo" >expect &&
+ write_script "fake browser" <<-\EOF &&
+
+ if test "$1" = "-version"; then
+ echo "Fake Firefox browser version 2.0.0"
+ else
+ # Firefox (in contrast to w3m) is run in background (with &)
+ # so redirect output to "actual"
+ echo "fake: ""$@" >actual
+ fi
+ : >fake_browser_ran
+ EOF
+ git config browser.firefox.path "$(pwd)/fake browser" &&
+ test_web_browse firefox http://example.com/foo 5
+'
+
+test_expect_success \
'browser command allows arbitrary shell code' '
echo "arg: http://example.com/foo" >expect &&
git config browser.custom.cmd "
--
1.8.1.1.10.g71fa0b7
^ permalink raw reply related
* [PATCH v2 0/2] git-web--browser: avoid errors in terminal when running
From: Alexey Shumkin @ 2013-01-26 0:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Alexey Shumkin, git
In-Reply-To: <7v1ud93uw8.fsf@alter.siamese.dyndns.org>
Reroll patch after all suggestions
Alexey Shumkin (2):
t9901-git-web--browse.sh: Use "write_script" helper
git-web--browser: avoid errors in terminal when running Firefox on
Windows
git-web--browse.sh | 2 +-
t/t9901-git-web--browse.sh | 59 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 55 insertions(+), 6 deletions(-)
--
1.8.1.1.10.g71fa0b7
^ permalink raw reply
* Re: Version 1.8.1 does not compile on Cygwin 1.7.14
From: Eric Blake @ 2013-01-26 0:34 UTC (permalink / raw)
To: Junio C Hamano
Cc: Mark Levedahl, Ramsay Jones, Jonathan Nieder, Alex Riesen,
Jason Pyeron, git, Torsten Bögershausen,
Stephen & Linda Smith
In-Reply-To: <7v38xo3irh.fsf@alter.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]
On 01/25/2013 05:11 PM, Junio C Hamano wrote:
> Mark Levedahl <mlevedahl@gmail.com> writes:
>
>> Cygwin and Windows should be treated as completely separate platforms:
>> if __CYGWIN__ is defined, do one thing, if not, go ahead and check
>> WIN32, but the WIN32 macro should never be tested once we know the
>> platform is CYGWIN - these really are different platforms (if you are
>> unsure of this, consider that Cygwin includes a cross-compiler to
>> target native Win32 as the Cygwin maintainers recognized the platforms
>> are different).
>
> Not disagreeing with your conclusion (they should be treated as
> different), why does it define WIN32 in the first place?
>
> Perhaps we would want
>
> #ifdef __CYGWIN__
> #undef WIN32
> #endif
Wouldn't work. Cygwin gcc does NOT define WIN32; rather, the inclusion
of a Windows system header (generally discouraged, but sometimes a
necessary evil) might cause WIN32 to be defined for all subsequent headers.
Which is why other projects, like gnulib, have
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
all over the place.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
^ permalink raw reply
* Re: [PATCH 8/7] mergetool--lib: don't call "exit" in setup_tool
From: Junio C Hamano @ 2013-01-26 0:24 UTC (permalink / raw)
To: John Keeping; +Cc: David Aguilar, git
In-Reply-To: <20130125220359.GF7498@serenity.lan>
Applying this one on top of 1/7 thru 5/7 and 7/7 seems to break
t7610 rather badly.
--- >8 ------ >8 ------ >8 ------ >8 ------ >8 ------ >8 ---
...
ok 1 - setup
expecting success:
git checkout -b test1 branch1 &&
git submodule update -N &&
test_must_fail git merge master >/dev/null 2>&1 &&
( yes "" | git mergetool both >/dev/null 2>&1 ) &&
( yes "" | git mergetool file1 file1 ) &&
( yes "" | git mergetool file2 "spaced name" >/dev/null 2>&1 ) &&
( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
( yes "l" | git mergetool submod >/dev/null 2>&1 ) &&
test "$(cat file1)" = "master updated" &&
test "$(cat file2)" = "master new" &&
test "$(cat subdir/file3)" = "master new sub" &&
test "$(cat submod/bar)" = "branch1 submodule" &&
git commit -m "branch1 resolved with mergetool"
M submod
Switched to a new branch 'test1'
Submodule path 'submod': checked out '39c7f044ed2e6a9cebd5266529badd181c8762b5'
not ok - 2 custom mergetool
#
# git checkout -b test1 branch1 &&
# git submodule update -N &&
# test_must_fail git merge master >/dev/null 2>&1 &&
# ( yes "" | git mergetool both >/dev/null 2>&1 ) &&
# ( yes "" | git mergetool file1 file1 ) &&
# ( yes "" | git mergetool file2 "spaced name" >/dev/null 2>&1 ) &&
# ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
# ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
# ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
# ( yes "l" | git mergetool submod >/dev/null 2>&1 ) &&
# test "$(cat file1)" = "master updated" &&
# test "$(cat file2)" = "master new" &&
# test "$(cat subdir/file3)" = "master new sub" &&
# test "$(cat submod/bar)" = "branch1 submodule" &&
# git commit -m "branch1 resolved with mergetool"
#
--- 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ---
Due to ">dev/null 2>&1", all of the error clues are hidden, and I
didn't dig further to see which one was failing (this is why tests
shouldn't do these in general).
^ permalink raw reply
* What's cooking in git.git (Jan 2013, #09; Fri, 25)
From: Junio C Hamano @ 2013-01-26 0:23 UTC (permalink / raw)
To: git
What's cooking in git.git (Jan 2013, #09; Fri, 25)
--------------------------------------------------
Here are the topics that have been cooking. Commits prefixed with
'-' are only in 'pu' (proposed updates) while commits prefixed with
'+' are in 'next'.
As usual, this cycle is expected to last for 8 to 10 weeks, with a
preview -rc0 sometime in the middle of next month.
You can find the changes described here in the integration branches of the
repositories listed at
http://git-blame.blogspot.com/p/git-public-repositories.html
--------------------------------------------------
[Graduated to "master"]
* as/check-ignore (2013-01-16) 13 commits
(merged to 'next' on 2013-01-18 at ef45aff)
+ clean.c, ls-files.c: respect encapsulation of exclude_list_groups
(merged to 'next' on 2013-01-14 at 9df2afc)
+ t0008: avoid brace expansion
+ add git-check-ignore sub-command
+ setup.c: document get_pathspec()
+ add.c: extract new die_if_path_beyond_symlink() for reuse
+ add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse
+ pathspec.c: rename newly public functions for clarity
+ add.c: move pathspec matchers into new pathspec.c for reuse
+ add.c: remove unused argument from validate_pathspec()
+ dir.c: improve docs for match_pathspec() and match_pathspec_depth()
+ dir.c: provide clear_directory() for reclaiming dir_struct memory
+ dir.c: keep track of where patterns came from
+ dir.c: use a single struct exclude_list per source of excludes
Add a new command "git check-ignore" for debugging .gitignore
files. The variable names may want to get cleaned up but that can
be done in-tree.
* as/pre-push-hook (2013-01-18) 3 commits
(merged to 'next' on 2013-01-18 at 37fc4e8)
+ Add sample pre-push hook script
+ push: Add support for pre-push hooks
+ hooks: Add function to check if a hook exists
Add an extra hook so that "git push" that is run without making
sure what is being pushed is sane can be checked and rejected (as
opposed to the user deciding not pushing).
* ch/add-auto-submitted-in-sample-post-receive-email (2013-01-17) 1 commit
(merged to 'next' on 2013-01-18 at e3205db)
+ Add Auto-Submitted header to post-receive-email
Mark e-mails coming from automated processes should be marked as
such; update a sample hook to do so.
* cr/push-force-tag-update (2013-01-16) 1 commit
(merged to 'next' on 2013-01-18 at c9091d5)
+ push: fix "refs/tags/ hierarchy cannot be updated without --force"
(this branch is used by jc/push-reject-reasons.)
Regression fix, not to say "already exists" when we traditionally
said "non fast-forward'.
* jc/doc-maintainer (2013-01-03) 2 commits
(merged to 'next' on 2013-01-11 at f35d582)
+ howto/maintain: mark titles for asciidoc
+ Documentation: update "howto maintain git"
Describe tools for automation that were invented since this
document was originally written.
* jk/suppress-clang-warning (2013-01-16) 1 commit
(merged to 'next' on 2013-01-18 at 7c0bda7)
+ fix clang -Wunused-value warnings for error functions
* mh/imap-send-shrinkage (2013-01-15) 14 commits
(merged to 'next' on 2013-01-18 at 1b7c5ba)
+ imap-send.c: simplify logic in lf_to_crlf()
+ imap-send.c: fold struct store into struct imap_store
+ imap-send.c: remove unused field imap_store::uidvalidity
+ imap-send.c: use struct imap_store instead of struct store
+ imap-send.c: remove unused field imap_store::trashnc
+ imap-send.c: remove namespace fields from struct imap
+ imap-send.c: remove struct imap argument to parse_imap_list_l()
+ imap-send.c: inline parse_imap_list() in parse_list()
+ imap-send.c: remove some unused fields from struct store
+ imap-send.c: remove struct message
+ imap-send.c: remove struct store_conf
+ iamp-send.c: remove unused struct imap_store_conf
+ imap-send.c: remove struct msg_data
+ imap-send.c: remove msg_data::flags, which was always zero
Remove a lot of unused code from "git imap-send".
* mo/cvs-server-updates (2012-12-09) 18 commits
(merged to 'next' on 2013-01-08 at 75e2d11)
+ t9402: Use TABs for indentation
+ t9402: Rename check.cvsCount and check.list
+ t9402: Simplify git ls-tree
+ t9402: Add missing &&; Code style
+ t9402: No space after IO-redirection
+ t9402: Dont use test_must_fail cvs
+ t9402: improve check_end_tree() and check_end_full_tree()
+ t9402: sed -i is not portable
+ cvsserver Documentation: new cvs ... -r support
+ cvsserver: add t9402 to test branch and tag refs
+ cvsserver: support -r and sticky tags for most operations
+ cvsserver: Add version awareness to argsfromdir
+ cvsserver: generalize getmeta() to recognize commit refs
+ cvsserver: implement req_Sticky and related utilities
+ cvsserver: add misc commit lookup, file meta data, and file listing functions
+ cvsserver: define a tag name character escape mechanism
+ cvsserver: cleanup extra slashes in filename arguments
+ cvsserver: factor out git-log parsing logic
Various git-cvsserver updates.
* nd/retire-fnmatch (2013-01-01) 7 commits
(merged to 'next' on 2013-01-07 at ab31f9b)
+ Makefile: add USE_WILDMATCH to use wildmatch as fnmatch
+ wildmatch: advance faster in <asterisk> + <literal> patterns
+ wildmatch: make a special case for "*/" with FNM_PATHNAME
+ test-wildmatch: add "perf" command to compare wildmatch and fnmatch
+ wildmatch: support "no FNM_PATHNAME" mode
+ wildmatch: make dowild() take arbitrary flags
+ wildmatch: rename constants and update prototype
Replace our use of fnmatch(3) with a more feature-rich wildmatch.
A handful patches at the bottom have been moved to nd/wildmatch to
graduate as part of that branch, before this series solidifies.
* rs/clarify-entry-cmp-sslice (2013-01-16) 1 commit
(merged to 'next' on 2013-01-18 at d584dc6)
+ refs: use strncmp() instead of strlen() and memcmp()
--------------------------------------------------
[New Topics]
* jc/push-reject-reasons (2013-01-24) 4 commits
- push: finishing touches to explain REJECT_ALREADY_EXISTS better
- push: introduce REJECT_FETCH_FIRST and REJECT_NEEDS_FORCE
- push: further simplify the logic to assign rejection reason
- push: further clean up fields of "struct ref"
Improve error and advice messages given locally when "git push"
refuses when it cannot compute fast-forwardness by separating these
cases from the normal "not a fast-forward; merge first and push
again" case.
Will merge to 'next'.
* as/test-cleanup (2013-01-24) 1 commit
- t7102 (reset): don't hardcode SHA-1 in expected outputs
Will merge to 'next'.
* jc/do-not-let-random-file-interfere-with-completion-tests (2013-01-24) 1 commit
- t9902: protect test from stray build artifacts
Scripts to test bash completion was inherently flaky as it was
affected by whatever random things the user may have on $PATH.
Will merge to 'next'.
* jk/cvsimport-does-not-work-with-cvsps3 (2013-01-24) 1 commit
- git-cvsimport.txt: cvsps-2 is deprecated
Warn people that other tools are more recommendable over
cvsimport+cvsps2 combo when doing a one-shot import, and cvsimport
will not work with cvsps3.
Will merge to 'next'.
* jk/mergetool (2013-01-25) 6 commits
- mergetool--lib: Improve show_tool_help() output
- mergetools/vim: Remove redundant diff command
- git-difftool: use git-mergetool--lib for "--tool-help"
- git-mergetool: don't hardcode 'mergetool' in show_tool_help
- git-mergetool: remove redundant assignment
- git-mergetool: move show_tool_help to mergetool--lib
Cleans up mergetool/difftool combo.
It seems John Keeping has some more updates but the version posted
breaks the tests rather badly.
Expecting some follow-ups.
* jn/do-not-drop-username-when-reading-from-etc-mailname (2013-01-25) 1 commit
- ident: do not drop username when reading from /etc/mailname
We used to stuff "user@" and then append what we read from
/etc/mailname to come up with a default e-mail ident, but a bug
lost the "user@" part. This is to fix it.
Will merge to 'next'.
* mm/add-u-A-sans-pathspec (2013-01-25) 1 commit
- add: warn when -u or -A is used without pathspec
Forbid "git add -u" and "git add -A" without pathspec run from a
subdirectory, to train people to type "." (or ":/") to make the
choice of default does not matter.
Will merge to 'next'.
--------------------------------------------------
[Stalled]
* mp/complete-paths (2013-01-11) 1 commit
- git-completion.bash: add support for path completion
The completion script used to let the default completer to suggest
pathnames, which gave too many irrelevant choices (e.g. "git add"
would not want to add an unmodified path). Teach it to use a more
git-aware logic to enumerate only relevant ones.
Waiting for area-experts' help and review.
* jl/submodule-deinit (2012-12-04) 1 commit
- submodule: add 'deinit' command
There was no Porcelain way to say "I no longer am interested in
this submodule", once you express your interest in a submodule with
"submodule init". "submodule deinit" is the way to do so.
Expecting a reroll.
$gmane/212884
* jk/lua-hackery (2012-10-07) 6 commits
- pretty: fix up one-off format_commit_message calls
- Minimum compilation fixup
- Makefile: make "lua" a bit more configurable
- add a "lua" pretty format
- add basic lua infrastructure
- pretty: make some commit-parsing helpers more public
Interesting exercise. When we do this for real, we probably would want
to wrap a commit to make it more like an "object" with methods like
"parents", etc.
* rc/maint-complete-git-p4 (2012-09-24) 1 commit
- Teach git-completion about git p4
Comment from Pete will need to be addressed ($gmane/206172).
* jc/maint-name-rev (2012-09-17) 7 commits
- describe --contains: use "name-rev --algorithm=weight"
- name-rev --algorithm=weight: tests and documentation
- name-rev --algorithm=weight: cache the computed weight in notes
- name-rev --algorithm=weight: trivial optimization
- name-rev: --algorithm option
- name_rev: clarify the logic to assign a new tip-name to a commit
- name-rev: lose unnecessary typedef
"git name-rev" names the given revision based on a ref that can be
reached in the smallest number of steps from the rev, but that is
not useful when the caller wants to know which tag is the oldest one
that contains the rev. This teaches a new mode to the command that
uses the oldest ref among those which contain the rev.
I am not sure if this is worth it; for one thing, even with the help
from notes-cache, it seems to make the "describe --contains" even
slower. Also the command will be unusably slow for a user who does
not have a write access (hence unable to create or update the
notes-cache).
Stalled mostly due to lack of responses.
* jc/xprm-generation (2012-09-14) 1 commit
- test-generation: compute generation numbers and clock skews
A toy to analyze how bad the clock skews are in histories of real
world projects.
Stalled mostly due to lack of responses.
* jc/add-delete-default (2012-08-13) 1 commit
- git add: notice removal of tracked paths by default
"git add dir/" updated modified files and added new files, but does
not notice removed files, which may be "Huh?" to some users. They
can of course use "git add -A dir/", but why should they?
Resurrected from graveyard, as I thought it was a worthwhile thing
to do in the longer term.
Stalled mostly due to lack of responses.
* mb/remote-default-nn-origin (2012-07-11) 6 commits
- Teach get_default_remote to respect remote.default.
- Test that plain "git fetch" uses remote.default when on a detached HEAD.
- Teach clone to set remote.default.
- Teach "git remote" about remote.default.
- Teach remote.c about the remote.default configuration setting.
- Rename remote.c's default_remote_name static variables.
When the user does not specify what remote to interact with, we
often attempt to use 'origin'. This can now be customized via a
configuration variable.
Expecting a reroll.
$gmane/210151
"The first remote becomes the default" bit is better done as a
separate step.
* nd/parse-pathspec (2013-01-11) 20 commits
. Convert more init_pathspec() to parse_pathspec()
. Convert add_files_to_cache to take struct pathspec
. Convert {read,fill}_directory to take struct pathspec
. Convert refresh_index to take struct pathspec
. Convert report_path_error to take struct pathspec
. checkout: convert read_tree_some to take struct pathspec
. Convert unmerge_cache to take struct pathspec
. Convert read_cache_preload() to take struct pathspec
. add: convert to use parse_pathspec
. archive: convert to use parse_pathspec
. ls-files: convert to use parse_pathspec
. rm: convert to use parse_pathspec
. checkout: convert to use parse_pathspec
. rerere: convert to use parse_pathspec
. status: convert to use parse_pathspec
. commit: convert to use parse_pathspec
. clean: convert to use parse_pathspec
. Export parse_pathspec() and convert some get_pathspec() calls
. Add parse_pathspec() that converts cmdline args to struct pathspec
. pathspec: save the non-wildcard length part
Uses the parsed pathspec structure in more places where we used to
use the raw "array of strings" pathspec.
Ejected from 'pu' for now; will take a look at the rerolled one
later ($gmane/213340).
--------------------------------------------------
[Cooking]
* bc/fix-array-syntax-for-3.0-in-completion-bash (2013-01-18) 1 commit
(merged to 'next' on 2013-01-25 at d113c1a)
+ git-completion.bash: replace zsh notation that breaks bash 3.X
Fix use of an array notation that older versions of bash do not
understand.
* jc/help (2013-01-18) 1 commit
(merged to 'next' on 2013-01-25 at b2b087e)
+ help: include <common-cmds.h> only in one file
A header file that has the definition of a static array was
included in two places, wasting the space.
* jc/hidden-refs (2013-01-18) 2 commits
- upload-pack: allow hiding ref hiearchies
- upload-pack: share more code
Allow the server side to unclutter the refs/ namespace it shows by
default, while still allowing requests for histories leading to the
tips of hidden refs by updated clients (which are not written yet).
* jk/update-install-for-p4 (2013-01-20) 1 commit
- INSTALL: git-p4 doesn't support Python 3
Will merge to 'next'.
* tb/t0050-maint (2013-01-21) 3 commits
(merged to 'next' on 2013-01-25 at 682b1e2)
+ t0050: Use TAB for indentation
+ t0050: honor CASE_INSENSITIVE_FS in add (with different case)
+ t0050: known breakage vanished in merge (case change)
Update tests that were expecting to fail due to a bug that was
fixed earlier.
* nd/magic-pathspec-from-root (2013-01-21) 2 commits
(merged to 'next' on 2013-01-25 at b056b57)
+ grep: avoid accepting ambiguous revision
+ Update :/abc ambiguity check
When giving arguments without "--" disambiguation, object names
that come earlier on the command line must not be interpretable as
pathspecs and pathspecs that come later on the command line must
not be interpretable as object names. Tweak the disambiguation
rule so that ":/" (no other string before or after) is always
interpreted as a pathspec, to avoid having to say "git cmd -- :/".
* ta/doc-no-small-caps (2013-01-22) 10 commits
- fixup! Change 'git' to 'Git' whenever the whole system is referred to #4
- Change 'git' to 'Git' whenever the whole system is referred to #4
- fixup! Change 'git' to 'Git' whenever the whole system is referred to #3
- Change 'git' to 'Git' whenever the whole system is referred to #3
- fixup! Change 'git' to 'Git' whenever the whole system is referred to #2
- Change 'git' to 'Git' whenever the whole system is referred to #2
- fixup! fixup! Change 'git' to 'Git' whenever the whole system is referred to #1
- fixup! Change 'git' to 'Git' whenever the whole system is referred to #1
- Change 'git' to 'Git' whenever the whole system is referred to #1
- Documentation: avoid poor-man's small caps
Update documentation to change "GIT" which was a poor-man's small
caps to "Git" which was the intended spelling. Also change "git"
spelled in all-lowercase to "Git" when it refers to the system as
the whole or the concept it embodies, as opposed to the command the
end users would type.
Will wait for a week or so (say, til end of January) for Thomas to
collect fix-ups, squash the result into two patches and then merge
to 'next'.
* rr/minimal-stat (2013-01-22) 1 commit
(merged to 'next' on 2013-01-25 at 11c4453)
+ Enable minimal stat checking
Some reimplementations of Git does not write all the stat info back
to the index due to their implementation limitations (e.g. jgit
running on Java). A configuration option can tell Git to ignore
changes to most of the stat fields and only pay attention to mtime
and size, which these implementations can reliably update. This
avoids excessive revalidation of contents.
* jc/remove-treesame-parent-in-simplify-merges (2013-01-17) 1 commit
- simplify-merges: drop merge from irrelevant side branch
The --simplify-merges logic did not cull irrelevant parents from a
merge that is otherwise not interesting with respect to the paths
we are following.
As this touches a fairly core part of the revision traversal
infrastructure, it is appreciated to have an extra set of eyes for
sanity check.
Waiting for reviews and comments.
* jk/remote-helpers-in-python-3 (2013-01-24) 8 commits
(merged to 'next' on 2013-01-25 at acf9419)
+ git-remote-testpy: call print as a function
+ git-remote-testpy: don't do unbuffered text I/O
+ git-remote-testpy: hash bytes explicitly
+ svn-fe: allow svnrdump_sim.py to run with Python 3
+ git_remote_helpers: use 2to3 if building with Python 3
+ git_remote_helpers: force rebuild if python version changes
+ git_remote_helpers: fix input when running under Python 3
+ git_remote_helpers: allow building with Python 3
Prepare remote-helper test written in Python to be run with Python3.
* dl/am-hg-locale (2013-01-18) 1 commit
(merged to 'next' on 2013-01-25 at 3419019)
+ am: invoke perl's strftime in C locale
Datestamp recorded in "Hg" format patch was reformatted incorrectly
to an e-mail looking date using locale dependant strftime, causing
patch application to fail.
* jk/config-parsing-cleanup (2013-01-23) 8 commits
- reflog: use parse_config_key in config callback
- help: use parse_config_key for man config
- submodule: simplify memory handling in config parsing
- submodule: use parse_config_key when parsing config
- userdiff: drop parse_driver function
- convert some config callbacks to parse_config_key
- archive-tar: use parse_config_key when parsing config
- config: add helper function for parsing key names
Configuration parsing for tar.* configuration variables were
broken. Introduce a new config-keyname parser API to make the
callers much less error prone.
Will merge to 'next'.
* mp/diff-algo-config (2013-01-16) 3 commits
- diff: Introduce --diff-algorithm command line option
- config: Introduce diff.algorithm variable
- git-completion.bash: Autocomplete --minimal and --histogram for git-diff
Add diff.algorithm configuration so that the user does not type
"diff --histogram".
Looking better; may want tests to protect it from future breakages,
but otherwise it looks ready for 'next'.
Expecting a follow-up to add tests.
* jc/custom-comment-char (2013-01-16) 1 commit
(merged to 'next' on 2013-01-25 at 91d8a5d)
+ Allow custom "comment char"
An illustration to show codepaths that need to be touched to change
the hint lines in the edited text to begin with something other
than '#'.
This is half my work and half by Ralf Thielow. There may still be
leftover '#' lurking around, though. My "git grep" says C code
should be already fine, but git-rebase--interactive.sh could be
converted (it should not matter, as the file is not really a
free-form text).
I don't know how useful this will be in real life, though.
* nd/fetch-depth-is-broken (2013-01-11) 3 commits
(merged to 'next' on 2013-01-15 at 70a5ca7)
+ fetch: elaborate --depth action
+ upload-pack: fix off-by-one depth calculation in shallow clone
+ fetch: add --unshallow for turning shallow repo into complete one
"git fetch --depth" was broken in at least three ways. The
resulting history was deeper than specified by one commit, it was
unclear how to wipe the shallowness of the repository with the
command, and documentation was misleading.
Will cook in 'next'.
* jc/no-git-config-in-clone (2013-01-11) 1 commit
(merged to 'next' on 2013-01-15 at feeffe1)
+ clone: do not export and unexport GIT_CONFIG
We stopped paying attention to $GIT_CONFIG environment that points
at a single configuration file from any command other than "git config"
quite a while ago, but "git clone" internally set, exported, and
then unexported the variable during its operation unnecessarily.
Will cook in 'next'.
* dg/subtree-fixes (2013-01-08) 7 commits
- contrib/subtree: mkdir the manual directory if needed
- contrib/subtree: honor $(DESTDIR)
- contrib/subtree: fix synopsis and command help
- contrib/subtree: better error handling for "add"
- contrib/subtree: add --unannotate option
- contrib/subtree: use %B for split Subject/Body
- t7900: remove test number comments
contrib/subtree updates; there are a few more from T. Zheng that
were posted separately, with an overlap.
Expecting a reroll.
* jc/push-2.0-default-to-simple (2013-01-16) 14 commits
(merged to 'next' on 2013-01-16 at 23f5df2)
+ t5570: do not assume the "matching" push is the default
+ t5551: do not assume the "matching" push is the default
+ t5550: do not assume the "matching" push is the default
(merged to 'next' on 2013-01-09 at 74c3498)
+ doc: push.default is no longer "matching"
+ push: switch default from "matching" to "simple"
+ t9401: do not assume the "matching" push is the default
+ t9400: do not assume the "matching" push is the default
+ t7406: do not assume the "matching" push is the default
+ t5531: do not assume the "matching" push is the default
+ t5519: do not assume the "matching" push is the default
+ t5517: do not assume the "matching" push is the default
+ t5516: do not assume the "matching" push is the default
+ t5505: do not assume the "matching" push is the default
+ t5404: do not assume the "matching" push is the default
Will cook in 'next' until Git 2.0 ;-).
* mb/gitweb-highlight-link-target (2012-12-20) 1 commit
- Highlight the link target line in Gitweb using CSS
Expecting a reroll.
$gmane/211935
* bc/append-signed-off-by (2013-01-21) 10 commits
- Unify appending signoff in format-patch, commit and sequencer
- format-patch: update append_signoff prototype
- t4014: more tests about appending s-o-b lines
- sequencer.c: teach append_signoff to avoid adding a duplicate newline
- sequencer.c: teach append_signoff how to detect duplicate s-o-b
- sequencer.c: always separate "(cherry picked from" from commit body
- sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer
- t/t3511: add some tests of 'cherry-pick -s' functionality
- t/test-lib-functions.sh: allow to specify the tag name to test_commit
- sequencer.c: remove broken support for rfc2822 continuation in footer
Rerolled.
Expecting another reroll.
$gmane/214231
--------------------------------------------------
[Discarded]
* er/replace-cvsimport (2013-01-12) 7 commits
. t/lib-cvs: cvsimport no longer works without Python >= 2.7
. t9605: test for cvsps commit ordering bug
. t9604: fixup for new cvsimport
. t9600: fixup for new cvsimport
. t/lib-cvs.sh: allow cvsps version 3.x.
. t/t960[123]: remove leftover scripts
. cvsimport: rewrite to use cvsps 3.x to fix major bugs
Rerolled as jc/cvsimport-upgrade.
* jc/valgrind-memcmp-bsearch (2013-01-14) 1 commit
. ignore memcmp() overreading in bsearch() callback
Squelch false positive in valgrind tests; made unnecessary by
rewriting the callsite that confuses the tool.
* rs/archive-tar-config-parsing-fix (2013-01-14) 1 commit
. archive-tar: fix sanity check in config parsing
jk/config-parsing-cleanup made this topic unneeded.
* jc/cvsimport-upgrade (2013-01-14) 8 commits
- t9600: adjust for new cvsimport
- t9600: further prepare for sharing
- cvsimport-3: add a sample test
- cvsimport: make tests reusable for cvsimport-3
- cvsimport: start adding cvsps 3.x support
- cvsimport: introduce a version-switch wrapper
- cvsimport: allow setting a custom cvsps (2.x) program name
- Makefile: add description on PERL/PYTHON_PATH
People involved in cvsimport-3 say that the combination of it and
cvsps3 does not work with incremental import all that well. For
now, let's discard this and replace it with a documeentation update
that says "cvsimport will not work if you do not have cvsps2".
Will discard.
^ permalink raw reply
* Re: Version 1.8.1 does not compile on Cygwin 1.7.14
From: Junio C Hamano @ 2013-01-26 0:11 UTC (permalink / raw)
To: Mark Levedahl
Cc: Ramsay Jones, Jonathan Nieder, Alex Riesen, Jason Pyeron, git,
Torsten Bögershausen, Stephen & Linda Smith, Eric Blake
In-Reply-To: <51031C43.5030307@gmail.com>
Mark Levedahl <mlevedahl@gmail.com> writes:
> Cygwin and Windows should be treated as completely separate platforms:
> if __CYGWIN__ is defined, do one thing, if not, go ahead and check
> WIN32, but the WIN32 macro should never be tested once we know the
> platform is CYGWIN - these really are different platforms (if you are
> unsure of this, consider that Cygwin includes a cross-compiler to
> target native Win32 as the Cygwin maintainers recognized the platforms
> are different).
Not disagreeing with your conclusion (they should be treated as
different), why does it define WIN32 in the first place?
Perhaps we would want
#ifdef __CYGWIN__
#undef WIN32
#endif
very early in some include file before nothing else is included?
Just being curious.
^ permalink raw reply
* Re: Version 1.8.1 does not compile on Cygwin 1.7.14
From: Mark Levedahl @ 2013-01-25 23:58 UTC (permalink / raw)
To: Ramsay Jones
Cc: Jonathan Nieder, Alex Riesen, Junio C Hamano, Jason Pyeron, git,
Torsten Bögershausen, Stephen & Linda Smith, Eric Blake
In-Reply-To: <50FEDB08.6030901@ramsay1.demon.co.uk>
On 01/22/2013 01:31 PM, Ramsay Jones wrote:
> include order. ;-) As I have mentioned here before, the claim that
> "WIN32 is not defined on cygwin" is simply nonsense - it depends on
> if/when certain header files are included. For example, *as soon as*
> you include <windows.h> (and, I suspect, many other win32 headers)
> then "defined(WIN32)" is true. Note that commit 380a4d92 ("Update
> cygwin.c for new mingw-64 win32 api headers", 11-11-2012) swaps the
> include order for the win32.h and git-compat-util.h header files. [I
> don't know the details, Mark didn't elaborate, but it is clearly an
> include order problem on cygwin 1.7.x :-D ] This causes compilation
> errors on cygwin 1.5.x, exactly because win32.h includes <windows.h>,
> which defines WIN32, which then leads to git-compat-util.h including
> <winsock2.h>.
>> #if defined(WIN32) && defined(__CYGWIN__)
>> # undef WIN32
>> #endif
>
Cygwin and Windows should be treated as completely separate platforms:
if __CYGWIN__ is defined, do one thing, if not, go ahead and check
WIN32, but the WIN32 macro should never be tested once we know the
platform is CYGWIN - these really are different platforms (if you are
unsure of this, consider that Cygwin includes a cross-compiler to target
native Win32 as the Cygwin maintainers recognized the platforms are
different).
Mark
^ permalink raw reply
* Re: [PATCH] git-web--browser: avoid errors in terminal when running Firefox on Windows
From: Shumkin Alexey @ 2013-01-25 22:52 UTC (permalink / raw)
To: Jeff King; +Cc: git, Junio C Hamano
In-Reply-To: <20130125220617.GA23626@sigill.intra.peff.net>
2013/1/26 Jeff King <peff@peff.net>:
> On Fri, Jan 25, 2013 at 06:44:13PM +0400, Alexey Shumkin wrote:
>
>> test_web_browse () {
>> - # browser=$1 url=$2
>> + # browser=$1 url=$2 sleep_timeout=$3
>> + sleep_timeout="$3"
>> git web--browse --browser="$1" "$2" >actual &&
>> + # if $3 is set
>> + # as far as Firefox is run in background (it is run with &)
>> + # we trying to avoid race condition
>> + # by waiting for "$sleep_timeout" seconds of timeout for
>> 'fake_browser_ran' file appearance
>> + (test -z "$sleep_timeout" || (
>> + for timeout in $(seq 1 $sleep_timeout); do
>> + test -f fake_browser_ran && break
>> + sleep 1
>> + done
>> + test $timeout -ne $sleep_timeout
>> + )
>> + ) &&
>> tr -d '\015' <actual >text &&
>
> Gross, but I don't really see another way to handle the asynchronous
> nature of spawning background browsers.
>
> Two things, though:
>
> 1. Should test_web_browse just delete fake_browser_ran for us? Then
> later tests do not have to remember to do so.
Yep, you're right
>
> 2. Seeing fake_browser_ran appeared, we know that the script has
> started. But there is still a race condition in which it may not
> have written anything to "actual" yet.
Definitely right
>
> In this implementation:
>
>> + cat >"fake browser" <<-\EOF &&
>> + #!/bin/sh
>> +
>> + : > fake_browser_ran
>> + if test "$1" = "-version"; then
>> + echo Fake Firefox browser version 1.2.3
>> + else
>> + # Firefox (in contrast to w3m) is run in background (with
>> &)
>> + # so redirect output to "actual"
>> + echo fake: "$@" > actual
>> + fi
>> + EOF
>
> There is a period where fake_browser_ran exists, but nothing is in
> actual. You can solve it by setting fake_browser_ran at the end rather
> than the beginning.
>
> Or you can drop fake_browser_ran entirely, and just atomically move
> actual into place, like:
>
> echo "fake: $*" >actual.tmp
> mv actual.tmp actual
>
> and then tes-t_web_browse can just spin waiting for "actual" to appear.
Not exactly, because, as I see, "actual" file is a result of redirection of
> git web--browse --browser="$1" "$2" >actual &&
command
>
> -Peff
^ permalink raw reply
* [RFC] test-lint-duplicates: check numbering in contrib/remote-helpers
From: Torsten Bögershausen @ 2013-01-25 22:35 UTC (permalink / raw)
To: git; +Cc: tboegi
Running make inside contrib/remote-helpers failes in "test-lint-duplicates"
This was because the regexp to check for duplicate numbers strips everything
after the first "-" in the filename, including the prefix.
As a result, 2 pathnames like
"xxxx/contrib/remote-helpers/test-bzr.sh" and
"xxxx/contrib/remote-helpers/test-hg-bidi.sh"
are both converted into
"xxxx/contrib/remote" and reported as duplicate.
Improve the regexp:
Remove everything after "tNNNN-" (where X stand for a digit)
Rename the tests in contrib/remote-helpers into
t5810-test-bzr.sh,
t5820-test-hg-bidi.sh,
t5821-test-hg-hg-git.sh,
t5830-test-hg.sh
Feed the numbers used in contrib/remote-helpers into t/Makefile
and check that the numbering is unique across both directories
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
contrib/remote-helpers/Makefile | 3 +-
contrib/remote-helpers/t5810-test-bzr.sh | 143 +++++++
contrib/remote-helpers/t5820-test-hg-bidi.sh | 243 +++++++++++
contrib/remote-helpers/t5821-test-hg-hg-git.sh | 534 +++++++++++++++++++++++++
contrib/remote-helpers/t5830-test-hg.sh | 121 ++++++
contrib/remote-helpers/test-bzr.sh | 143 -------
contrib/remote-helpers/test-hg-bidi.sh | 243 -----------
contrib/remote-helpers/test-hg-hg-git.sh | 534 -------------------------
contrib/remote-helpers/test-hg.sh | 121 ------
t/Makefile | 2 +-
10 files changed, 1044 insertions(+), 1043 deletions(-)
create mode 100755 contrib/remote-helpers/t5810-test-bzr.sh
create mode 100755 contrib/remote-helpers/t5820-test-hg-bidi.sh
create mode 100755 contrib/remote-helpers/t5821-test-hg-hg-git.sh
create mode 100755 contrib/remote-helpers/t5830-test-hg.sh
delete mode 100755 contrib/remote-helpers/test-bzr.sh
delete mode 100755 contrib/remote-helpers/test-hg-bidi.sh
delete mode 100755 contrib/remote-helpers/test-hg-hg-git.sh
delete mode 100755 contrib/remote-helpers/test-hg.sh
diff --git a/contrib/remote-helpers/Makefile b/contrib/remote-helpers/Makefile
index 9a76575..012ad50 100644
--- a/contrib/remote-helpers/Makefile
+++ b/contrib/remote-helpers/Makefile
@@ -1,6 +1,7 @@
-TESTS := $(wildcard test*.sh)
+TESTS := $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
export T := $(addprefix $(CURDIR)/,$(TESTS))
+export TDUP := $(sort $(wildcard ../../t/t[0-9][0-9][0-9][0-9]-*.sh))
export MAKE := $(MAKE) -e
export PATH := $(CURDIR):$(PATH)
diff --git a/contrib/remote-helpers/t5810-test-bzr.sh b/contrib/remote-helpers/t5810-test-bzr.sh
new file mode 100755
index 0000000..70aa8a0
--- /dev/null
+++ b/contrib/remote-helpers/t5810-test-bzr.sh
@@ -0,0 +1,143 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+
+test_description='Test remote-bzr'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-bzr tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import bzrlib'; then
+ skip_all='skipping remote-bzr tests; bzr not available'
+ test_done
+fi
+
+cmd='
+import bzrlib
+bzrlib.initialize()
+import bzrlib.plugin
+bzrlib.plugin.load_plugins()
+import bzrlib.plugins.fastimport
+'
+
+if ! "$PYTHON_PATH" -c "$cmd"; then
+ echo "consider setting BZR_PLUGIN_PATH=$HOME/.bazaar/plugins" 1>&2
+ skip_all='skipping remote-bzr tests; bzr-fastimport not available'
+ test_done
+fi
+
+check () {
+ (cd $1 &&
+ git log --format='%s' -1 &&
+ git symbolic-ref HEAD) > actual &&
+ (echo $2 &&
+ echo "refs/heads/$3") > expected &&
+ test_cmp expected actual
+}
+
+bzr whoami "A U Thor <author@example.com>"
+
+test_expect_success 'cloning' '
+ (bzr init bzrrepo &&
+ cd bzrrepo &&
+ echo one > content &&
+ bzr add content &&
+ bzr commit -m one
+ ) &&
+
+ git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ check gitrepo one master
+'
+
+test_expect_success 'pulling' '
+ (cd bzrrepo &&
+ echo two > content &&
+ bzr commit -m two
+ ) &&
+
+ (cd gitrepo && git pull) &&
+
+ check gitrepo two master
+'
+
+test_expect_success 'pushing' '
+ (cd gitrepo &&
+ echo three > content &&
+ git commit -a -m three &&
+ git push
+ ) &&
+
+ echo three > expected &&
+ cat bzrrepo/content > actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'roundtrip' '
+ (cd gitrepo &&
+ git pull &&
+ git log --format="%s" -1 origin/master > actual) &&
+ echo three > expected &&
+ test_cmp expected actual &&
+
+ (cd gitrepo && git push && git pull) &&
+
+ (cd bzrrepo &&
+ echo four > content &&
+ bzr commit -m four
+ ) &&
+
+ (cd gitrepo && git pull && git push) &&
+
+ check gitrepo four master &&
+
+ (cd gitrepo &&
+ echo five > content &&
+ git commit -a -m five &&
+ git push && git pull
+ ) &&
+
+ (cd bzrrepo && bzr revert) &&
+
+ echo five > expected &&
+ cat bzrrepo/content > actual &&
+ test_cmp expected actual
+'
+
+cat > expected <<EOF
+100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
+100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
+120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
+EOF
+
+test_expect_success 'special modes' '
+ (cd bzrrepo &&
+ echo exec > executable
+ chmod +x executable &&
+ bzr add executable
+ bzr commit -m exec &&
+ ln -s content link
+ bzr add link
+ bzr commit -m link &&
+ mkdir dir &&
+ bzr add dir &&
+ bzr commit -m dir) &&
+
+ (cd gitrepo &&
+ git pull
+ git ls-tree HEAD > ../actual) &&
+
+ test_cmp expected actual &&
+
+ (cd gitrepo &&
+ git cat-file -p HEAD:link > ../actual) &&
+
+ echo -n content > expected &&
+ test_cmp expected actual
+'
+
+test_done
diff --git a/contrib/remote-helpers/t5820-test-hg-bidi.sh b/contrib/remote-helpers/t5820-test-hg-bidi.sh
new file mode 100755
index 0000000..1d61982
--- /dev/null
+++ b/contrib/remote-helpers/t5820-test-hg-bidi.sh
@@ -0,0 +1,243 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+# Base commands from hg-git tests:
+# https://bitbucket.org/durin42/hg-git/src
+#
+
+test_description='Test bidirectionality of remote-hg'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-hg tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import mercurial'; then
+ skip_all='skipping remote-hg tests; mercurial not available'
+ test_done
+fi
+
+# clone to a git repo
+git_clone () {
+ hg -R $1 bookmark -f -r tip master &&
+ git clone -q "hg::$PWD/$1" $2
+}
+
+# clone to an hg repo
+hg_clone () {
+ (
+ hg init $2 &&
+ cd $1 &&
+ git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
+ ) &&
+
+ (cd $2 && hg -q update)
+}
+
+# push an hg repo
+hg_push () {
+ (
+ cd $2
+ old=$(git symbolic-ref --short HEAD)
+ git checkout -q -b tmp &&
+ git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
+ git checkout -q $old &&
+ git branch -q -D tmp 2> /dev/null || true
+ )
+}
+
+hg_log () {
+ hg -R $1 log --graph --debug | grep -v 'tag: *default/'
+}
+
+setup () {
+ (
+ echo "[ui]"
+ echo "username = A U Thor <author@example.com>"
+ echo "[defaults]"
+ echo "backout = -d \"0 0\""
+ echo "commit = -d \"0 0\""
+ echo "debugrawcommit = -d \"0 0\""
+ echo "tag = -d \"0 0\""
+ ) >> "$HOME"/.hgrc &&
+ git config --global remote-hg.hg-git-compat true
+
+ export HGEDITOR=/usr/bin/true
+
+ export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+}
+
+setup
+
+test_expect_success 'encoding' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add älphà" &&
+
+ export GIT_AUTHOR_NAME="tést èncödîng" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+
+ echo gamma > gamma &&
+ git add gamma &&
+ git commit -m "add gämmâ" &&
+
+ : TODO git config i18n.commitencoding latin-1 &&
+ echo delta > delta &&
+ git add delta &&
+ git commit -m "add déltà"
+ ) &&
+
+ hg_clone gitrepo hgrepo &&
+ git_clone hgrepo gitrepo2 &&
+ hg_clone gitrepo2 hgrepo2 &&
+
+ HGENCODING=utf-8 hg_log hgrepo > expected &&
+ HGENCODING=utf-8 hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'file removal' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta"
+ mkdir foo &&
+ echo blah > foo/bar &&
+ git add foo &&
+ git commit -m "add foo" &&
+ git rm alpha &&
+ git commit -m "remove alpha" &&
+ git rm foo/bar &&
+ git commit -m "remove foo/bar"
+ ) &&
+
+ hg_clone gitrepo hgrepo &&
+ git_clone hgrepo gitrepo2 &&
+ hg_clone gitrepo2 hgrepo2 &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'git tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ git config receive.denyCurrentBranch ignore &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git tag alpha &&
+
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+ git tag -a -m "added tag beta" beta
+ ) &&
+
+ hg_clone gitrepo hgrepo &&
+ git_clone hgrepo gitrepo2 &&
+ hg_clone gitrepo2 hgrepo2 &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'hg branch' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -q -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone gitrepo hgrepo &&
+
+ cd hgrepo &&
+ hg -q co master &&
+ hg mv alpha beta &&
+ hg -q commit -m "rename alpha to beta" &&
+ hg branch gamma | grep -v "permanent and global" &&
+ hg -q commit -m "started branch gamma"
+ ) &&
+
+ hg_push hgrepo gitrepo &&
+ hg_clone gitrepo hgrepo2 &&
+
+ : TODO, avoid "master" bookmark &&
+ (cd hgrepo2 && hg checkout gamma) &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'hg tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone gitrepo hgrepo &&
+
+ cd hgrepo &&
+ hg co master &&
+ hg tag alpha
+ ) &&
+
+ hg_push hgrepo gitrepo &&
+ hg_clone gitrepo hgrepo2 &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_done
diff --git a/contrib/remote-helpers/t5821-test-hg-hg-git.sh b/contrib/remote-helpers/t5821-test-hg-hg-git.sh
new file mode 100755
index 0000000..7e3967f
--- /dev/null
+++ b/contrib/remote-helpers/t5821-test-hg-hg-git.sh
@@ -0,0 +1,534 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+# Base commands from hg-git tests:
+# https://bitbucket.org/durin42/hg-git/src
+#
+
+test_description='Test remote-hg output compared to hg-git'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-hg tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import mercurial'; then
+ skip_all='skipping remote-hg tests; mercurial not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import hggit'; then
+ skip_all='skipping remote-hg tests; hg-git not available'
+ test_done
+fi
+
+# clone to a git repo with git
+git_clone_git () {
+ hg -R $1 bookmark -f -r tip master &&
+ git clone -q "hg::$PWD/$1" $2
+}
+
+# clone to an hg repo with git
+hg_clone_git () {
+ (
+ hg init $2 &&
+ cd $1 &&
+ git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
+ ) &&
+
+ (cd $2 && hg -q update)
+}
+
+# clone to a git repo with hg
+git_clone_hg () {
+ (
+ git init -q $2 &&
+ cd $1 &&
+ hg bookmark -f -r tip master &&
+ hg -q push -r master ../$2 || true
+ )
+}
+
+# clone to an hg repo with hg
+hg_clone_hg () {
+ hg -q clone $1 $2
+}
+
+# push an hg repo with git
+hg_push_git () {
+ (
+ cd $2
+ old=$(git symbolic-ref --short HEAD)
+ git checkout -q -b tmp &&
+ git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
+ git checkout -q $old &&
+ git branch -q -D tmp 2> /dev/null || true
+ )
+}
+
+# push an hg git repo with hg
+hg_push_hg () {
+ (
+ cd $1 &&
+ hg -q push ../$2 || true
+ )
+}
+
+hg_log () {
+ hg -R $1 log --graph --debug | grep -v 'tag: *default/'
+}
+
+git_log () {
+ git --git-dir=$1/.git fast-export --branches
+}
+
+setup () {
+ (
+ echo "[ui]"
+ echo "username = A U Thor <author@example.com>"
+ echo "[defaults]"
+ echo "backout = -d \"0 0\""
+ echo "commit = -d \"0 0\""
+ echo "debugrawcommit = -d \"0 0\""
+ echo "tag = -d \"0 0\""
+ echo "[extensions]"
+ echo "hgext.bookmarks ="
+ echo "hggit ="
+ ) >> "$HOME"/.hgrc &&
+ git config --global receive.denycurrentbranch warn
+ git config --global remote-hg.hg-git-compat true
+
+ export HGEDITOR=/usr/bin/true
+
+ export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+}
+
+setup
+
+test_expect_success 'executable bit' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ chmod 0644 alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ chmod 0755 alpha &&
+ git add alpha &&
+ git commit -m "set executable bit" &&
+ chmod 0644 alpha &&
+ git add alpha &&
+ git commit -m "clear executable bit"
+ ) &&
+
+ for x in hg git; do
+ (
+ hg_clone_$x gitrepo hgrepo-$x &&
+ cd hgrepo-$x &&
+ hg_log . &&
+ hg manifest -r 1 -v &&
+ hg manifest -v
+ ) > output-$x &&
+
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+ git_log gitrepo2-$x > log-$x
+ done &&
+ cp -r log-* output-* /tmp/foo/ &&
+
+ test_cmp output-hg output-git &&
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'symlink' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ ln -s alpha beta &&
+ git add beta &&
+ git commit -m "add beta"
+ ) &&
+
+ for x in hg git; do
+ (
+ hg_clone_$x gitrepo hgrepo-$x &&
+ cd hgrepo-$x &&
+ hg_log . &&
+ hg manifest -v
+ ) > output-$x &&
+
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+ git_log gitrepo2-$x > log-$x
+ done &&
+
+ test_cmp output-hg output-git &&
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'merge conflict 1' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ hg init hgrepo1 &&
+ cd hgrepo1 &&
+ echo A > afile &&
+ hg add afile &&
+ hg ci -m "origin" &&
+
+ echo B > afile &&
+ hg ci -m "A->B" &&
+
+ hg up -r0 &&
+ echo C > afile &&
+ hg ci -m "A->C" &&
+
+ hg merge -r1 || true &&
+ echo C > afile &&
+ hg resolve -m afile &&
+ hg ci -m "merge to C"
+ ) &&
+
+ for x in hg git; do
+ git_clone_$x hgrepo1 gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'merge conflict 2' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ hg init hgrepo1 &&
+ cd hgrepo1 &&
+ echo A > afile &&
+ hg add afile &&
+ hg ci -m "origin" &&
+
+ echo B > afile &&
+ hg ci -m "A->B" &&
+
+ hg up -r0 &&
+ echo C > afile &&
+ hg ci -m "A->C" &&
+
+ hg merge -r1 || true &&
+ echo B > afile &&
+ hg resolve -m afile &&
+ hg ci -m "merge to B"
+ ) &&
+
+ for x in hg git; do
+ git_clone_$x hgrepo1 gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'converged merge' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ hg init hgrepo1 &&
+ cd hgrepo1 &&
+ echo A > afile &&
+ hg add afile &&
+ hg ci -m "origin" &&
+
+ echo B > afile &&
+ hg ci -m "A->B" &&
+
+ echo C > afile &&
+ hg ci -m "B->C" &&
+
+ hg up -r0 &&
+ echo C > afile &&
+ hg ci -m "A->C" &&
+
+ hg merge -r2 || true &&
+ hg ci -m "merge"
+ ) &&
+
+ for x in hg git; do
+ git_clone_$x hgrepo1 gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'encoding' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add älphà" &&
+
+ export GIT_AUTHOR_NAME="tést èncödîng" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+
+ echo gamma > gamma &&
+ git add gamma &&
+ git commit -m "add gämmâ" &&
+
+ : TODO git config i18n.commitencoding latin-1 &&
+ echo delta > delta &&
+ git add delta &&
+ git commit -m "add déltà"
+ ) &&
+
+ for x in hg git; do
+ hg_clone_$x gitrepo hgrepo-$x &&
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+
+ HGENCODING=utf-8 hg_log hgrepo-$x > hg-log-$x &&
+ git_log gitrepo2-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'file removal' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta"
+ mkdir foo &&
+ echo blah > foo/bar &&
+ git add foo &&
+ git commit -m "add foo" &&
+ git rm alpha &&
+ git commit -m "remove alpha" &&
+ git rm foo/bar &&
+ git commit -m "remove foo/bar"
+ ) &&
+
+ for x in hg git; do
+ (
+ hg_clone_$x gitrepo hgrepo-$x &&
+ cd hgrepo-$x &&
+ hg_log . &&
+ hg manifest -r 3 &&
+ hg manifest
+ ) > output-$x &&
+
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+ git_log gitrepo2-$x > log-$x
+ done &&
+
+ test_cmp output-hg output-git &&
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'git tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ git config receive.denyCurrentBranch ignore &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git tag alpha &&
+
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+ git tag -a -m "added tag beta" beta
+ ) &&
+
+ for x in hg git; do
+ hg_clone_$x gitrepo hgrepo-$x &&
+ hg_log hgrepo-$x > log-$x
+ done &&
+
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'hg author' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ for x in hg git; do
+ (
+ git init -q gitrepo-$x &&
+ cd gitrepo-$x &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone_$x gitrepo-$x hgrepo-$x &&
+ cd hgrepo-$x &&
+
+ hg co master &&
+ echo beta > beta &&
+ hg add beta &&
+ hg commit -u "test" -m "add beta" &&
+
+ echo gamma >> beta &&
+ hg commit -u "test <test@example.com> (comment)" -m "modify beta" &&
+
+ echo gamma > gamma &&
+ hg add gamma &&
+ hg commit -u "<test@example.com>" -m "add gamma" &&
+
+ echo delta > delta &&
+ hg add delta &&
+ hg commit -u "name<test@example.com>" -m "add delta" &&
+
+ echo epsilon > epsilon &&
+ hg add epsilon &&
+ hg commit -u "name <test@example.com" -m "add epsilon" &&
+
+ echo zeta > zeta &&
+ hg add zeta &&
+ hg commit -u " test " -m "add zeta" &&
+
+ echo eta > eta &&
+ hg add eta &&
+ hg commit -u "test < test@example.com >" -m "add eta" &&
+
+ echo theta > theta &&
+ hg add theta &&
+ hg commit -u "test >test@example.com>" -m "add theta" &&
+
+ echo iota > iota &&
+ hg add iota &&
+ hg commit -u "test <test <at> example <dot> com>" -m "add iota"
+ ) &&
+
+ hg_push_$x hgrepo-$x gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp git-log-hg git-log-git &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'hg branch' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ for x in hg git; do
+ (
+ git init -q gitrepo-$x &&
+ cd gitrepo-$x &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -q -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone_$x gitrepo-$x hgrepo-$x &&
+
+ cd hgrepo-$x &&
+ hg -q co master &&
+ hg mv alpha beta &&
+ hg -q commit -m "rename alpha to beta" &&
+ hg branch gamma | grep -v "permanent and global" &&
+ hg -q commit -m "started branch gamma"
+ ) &&
+
+ hg_push_$x hgrepo-$x gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'hg tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ for x in hg git; do
+ (
+ git init -q gitrepo-$x &&
+ cd gitrepo-$x &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone_$x gitrepo-$x hgrepo-$x &&
+
+ cd hgrepo-$x &&
+ hg co master &&
+ hg tag alpha
+ ) &&
+
+ hg_push_$x hgrepo-$x gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+
+ (
+ git --git-dir=gitrepo-$x/.git tag -l &&
+ hg_log hgrepo2-$x &&
+ cat hgrepo2-$x/.hgtags
+ ) > output-$x
+ done &&
+
+ test_cmp output-hg output-git
+'
+
+test_done
diff --git a/contrib/remote-helpers/t5830-test-hg.sh b/contrib/remote-helpers/t5830-test-hg.sh
new file mode 100755
index 0000000..5f81dfa
--- /dev/null
+++ b/contrib/remote-helpers/t5830-test-hg.sh
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+# Base commands from hg-git tests:
+# https://bitbucket.org/durin42/hg-git/src
+#
+
+test_description='Test remote-hg'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-hg tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import mercurial'; then
+ skip_all='skipping remote-hg tests; mercurial not available'
+ test_done
+fi
+
+check () {
+ (cd $1 &&
+ git log --format='%s' -1 &&
+ git symbolic-ref HEAD) > actual &&
+ (echo $2 &&
+ echo "refs/heads/$3") > expected &&
+ test_cmp expected actual
+}
+
+setup () {
+ (
+ echo "[ui]"
+ echo "username = H G Wells <wells@example.com>"
+ ) >> "$HOME"/.hgrc
+}
+
+setup
+
+test_expect_success 'cloning' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ hg init hgrepo &&
+ cd hgrepo &&
+ echo zero > content &&
+ hg add content &&
+ hg commit -m zero
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo zero master
+'
+
+test_expect_success 'cloning with branches' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg branch next &&
+ echo next > content &&
+ hg commit -m next
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo next next &&
+
+ (cd hgrepo && hg checkout default) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo2 &&
+ check gitrepo2 zero master
+'
+
+test_expect_success 'cloning with bookmarks' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg bookmark feature-a &&
+ echo feature-a > content &&
+ hg commit -m feature-a
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo feature-a feature-a
+'
+
+test_expect_success 'cloning with detached head' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg update -r 0
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo zero master
+'
+
+test_expect_success 'update bookmark' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg bookmark devel
+ ) &&
+
+ (
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ cd gitrepo &&
+ git checkout devel &&
+ echo devel > content &&
+ git commit -a -m devel &&
+ git push
+ ) &&
+
+ hg -R hgrepo bookmarks | grep "devel\s\+3:"
+'
+
+test_done
diff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.sh
deleted file mode 100755
index 70aa8a0..0000000
--- a/contrib/remote-helpers/test-bzr.sh
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-
-test_description='Test remote-bzr'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-bzr tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import bzrlib'; then
- skip_all='skipping remote-bzr tests; bzr not available'
- test_done
-fi
-
-cmd='
-import bzrlib
-bzrlib.initialize()
-import bzrlib.plugin
-bzrlib.plugin.load_plugins()
-import bzrlib.plugins.fastimport
-'
-
-if ! "$PYTHON_PATH" -c "$cmd"; then
- echo "consider setting BZR_PLUGIN_PATH=$HOME/.bazaar/plugins" 1>&2
- skip_all='skipping remote-bzr tests; bzr-fastimport not available'
- test_done
-fi
-
-check () {
- (cd $1 &&
- git log --format='%s' -1 &&
- git symbolic-ref HEAD) > actual &&
- (echo $2 &&
- echo "refs/heads/$3") > expected &&
- test_cmp expected actual
-}
-
-bzr whoami "A U Thor <author@example.com>"
-
-test_expect_success 'cloning' '
- (bzr init bzrrepo &&
- cd bzrrepo &&
- echo one > content &&
- bzr add content &&
- bzr commit -m one
- ) &&
-
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
- check gitrepo one master
-'
-
-test_expect_success 'pulling' '
- (cd bzrrepo &&
- echo two > content &&
- bzr commit -m two
- ) &&
-
- (cd gitrepo && git pull) &&
-
- check gitrepo two master
-'
-
-test_expect_success 'pushing' '
- (cd gitrepo &&
- echo three > content &&
- git commit -a -m three &&
- git push
- ) &&
-
- echo three > expected &&
- cat bzrrepo/content > actual &&
- test_cmp expected actual
-'
-
-test_expect_success 'roundtrip' '
- (cd gitrepo &&
- git pull &&
- git log --format="%s" -1 origin/master > actual) &&
- echo three > expected &&
- test_cmp expected actual &&
-
- (cd gitrepo && git push && git pull) &&
-
- (cd bzrrepo &&
- echo four > content &&
- bzr commit -m four
- ) &&
-
- (cd gitrepo && git pull && git push) &&
-
- check gitrepo four master &&
-
- (cd gitrepo &&
- echo five > content &&
- git commit -a -m five &&
- git push && git pull
- ) &&
-
- (cd bzrrepo && bzr revert) &&
-
- echo five > expected &&
- cat bzrrepo/content > actual &&
- test_cmp expected actual
-'
-
-cat > expected <<EOF
-100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
-100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
-120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
-EOF
-
-test_expect_success 'special modes' '
- (cd bzrrepo &&
- echo exec > executable
- chmod +x executable &&
- bzr add executable
- bzr commit -m exec &&
- ln -s content link
- bzr add link
- bzr commit -m link &&
- mkdir dir &&
- bzr add dir &&
- bzr commit -m dir) &&
-
- (cd gitrepo &&
- git pull
- git ls-tree HEAD > ../actual) &&
-
- test_cmp expected actual &&
-
- (cd gitrepo &&
- git cat-file -p HEAD:link > ../actual) &&
-
- echo -n content > expected &&
- test_cmp expected actual
-'
-
-test_done
diff --git a/contrib/remote-helpers/test-hg-bidi.sh b/contrib/remote-helpers/test-hg-bidi.sh
deleted file mode 100755
index 1d61982..0000000
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-# Base commands from hg-git tests:
-# https://bitbucket.org/durin42/hg-git/src
-#
-
-test_description='Test bidirectionality of remote-hg'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-hg tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
- skip_all='skipping remote-hg tests; mercurial not available'
- test_done
-fi
-
-# clone to a git repo
-git_clone () {
- hg -R $1 bookmark -f -r tip master &&
- git clone -q "hg::$PWD/$1" $2
-}
-
-# clone to an hg repo
-hg_clone () {
- (
- hg init $2 &&
- cd $1 &&
- git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
- ) &&
-
- (cd $2 && hg -q update)
-}
-
-# push an hg repo
-hg_push () {
- (
- cd $2
- old=$(git symbolic-ref --short HEAD)
- git checkout -q -b tmp &&
- git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
- git checkout -q $old &&
- git branch -q -D tmp 2> /dev/null || true
- )
-}
-
-hg_log () {
- hg -R $1 log --graph --debug | grep -v 'tag: *default/'
-}
-
-setup () {
- (
- echo "[ui]"
- echo "username = A U Thor <author@example.com>"
- echo "[defaults]"
- echo "backout = -d \"0 0\""
- echo "commit = -d \"0 0\""
- echo "debugrawcommit = -d \"0 0\""
- echo "tag = -d \"0 0\""
- ) >> "$HOME"/.hgrc &&
- git config --global remote-hg.hg-git-compat true
-
- export HGEDITOR=/usr/bin/true
-
- export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
- export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
-}
-
-setup
-
-test_expect_success 'encoding' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add älphà" &&
-
- export GIT_AUTHOR_NAME="tést èncödîng" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
-
- echo gamma > gamma &&
- git add gamma &&
- git commit -m "add gämmâ" &&
-
- : TODO git config i18n.commitencoding latin-1 &&
- echo delta > delta &&
- git add delta &&
- git commit -m "add déltà"
- ) &&
-
- hg_clone gitrepo hgrepo &&
- git_clone hgrepo gitrepo2 &&
- hg_clone gitrepo2 hgrepo2 &&
-
- HGENCODING=utf-8 hg_log hgrepo > expected &&
- HGENCODING=utf-8 hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'file removal' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta"
- mkdir foo &&
- echo blah > foo/bar &&
- git add foo &&
- git commit -m "add foo" &&
- git rm alpha &&
- git commit -m "remove alpha" &&
- git rm foo/bar &&
- git commit -m "remove foo/bar"
- ) &&
-
- hg_clone gitrepo hgrepo &&
- git_clone hgrepo gitrepo2 &&
- hg_clone gitrepo2 hgrepo2 &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'git tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- git config receive.denyCurrentBranch ignore &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git tag alpha &&
-
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
- git tag -a -m "added tag beta" beta
- ) &&
-
- hg_clone gitrepo hgrepo &&
- git_clone hgrepo gitrepo2 &&
- hg_clone gitrepo2 hgrepo2 &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'hg branch' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -q -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone gitrepo hgrepo &&
-
- cd hgrepo &&
- hg -q co master &&
- hg mv alpha beta &&
- hg -q commit -m "rename alpha to beta" &&
- hg branch gamma | grep -v "permanent and global" &&
- hg -q commit -m "started branch gamma"
- ) &&
-
- hg_push hgrepo gitrepo &&
- hg_clone gitrepo hgrepo2 &&
-
- : TODO, avoid "master" bookmark &&
- (cd hgrepo2 && hg checkout gamma) &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'hg tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone gitrepo hgrepo &&
-
- cd hgrepo &&
- hg co master &&
- hg tag alpha
- ) &&
-
- hg_push hgrepo gitrepo &&
- hg_clone gitrepo hgrepo2 &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_done
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh b/contrib/remote-helpers/test-hg-hg-git.sh
deleted file mode 100755
index 7e3967f..0000000
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ /dev/null
@@ -1,534 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-# Base commands from hg-git tests:
-# https://bitbucket.org/durin42/hg-git/src
-#
-
-test_description='Test remote-hg output compared to hg-git'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-hg tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
- skip_all='skipping remote-hg tests; mercurial not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import hggit'; then
- skip_all='skipping remote-hg tests; hg-git not available'
- test_done
-fi
-
-# clone to a git repo with git
-git_clone_git () {
- hg -R $1 bookmark -f -r tip master &&
- git clone -q "hg::$PWD/$1" $2
-}
-
-# clone to an hg repo with git
-hg_clone_git () {
- (
- hg init $2 &&
- cd $1 &&
- git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
- ) &&
-
- (cd $2 && hg -q update)
-}
-
-# clone to a git repo with hg
-git_clone_hg () {
- (
- git init -q $2 &&
- cd $1 &&
- hg bookmark -f -r tip master &&
- hg -q push -r master ../$2 || true
- )
-}
-
-# clone to an hg repo with hg
-hg_clone_hg () {
- hg -q clone $1 $2
-}
-
-# push an hg repo with git
-hg_push_git () {
- (
- cd $2
- old=$(git symbolic-ref --short HEAD)
- git checkout -q -b tmp &&
- git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
- git checkout -q $old &&
- git branch -q -D tmp 2> /dev/null || true
- )
-}
-
-# push an hg git repo with hg
-hg_push_hg () {
- (
- cd $1 &&
- hg -q push ../$2 || true
- )
-}
-
-hg_log () {
- hg -R $1 log --graph --debug | grep -v 'tag: *default/'
-}
-
-git_log () {
- git --git-dir=$1/.git fast-export --branches
-}
-
-setup () {
- (
- echo "[ui]"
- echo "username = A U Thor <author@example.com>"
- echo "[defaults]"
- echo "backout = -d \"0 0\""
- echo "commit = -d \"0 0\""
- echo "debugrawcommit = -d \"0 0\""
- echo "tag = -d \"0 0\""
- echo "[extensions]"
- echo "hgext.bookmarks ="
- echo "hggit ="
- ) >> "$HOME"/.hgrc &&
- git config --global receive.denycurrentbranch warn
- git config --global remote-hg.hg-git-compat true
-
- export HGEDITOR=/usr/bin/true
-
- export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
- export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
-}
-
-setup
-
-test_expect_success 'executable bit' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- chmod 0644 alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- chmod 0755 alpha &&
- git add alpha &&
- git commit -m "set executable bit" &&
- chmod 0644 alpha &&
- git add alpha &&
- git commit -m "clear executable bit"
- ) &&
-
- for x in hg git; do
- (
- hg_clone_$x gitrepo hgrepo-$x &&
- cd hgrepo-$x &&
- hg_log . &&
- hg manifest -r 1 -v &&
- hg manifest -v
- ) > output-$x &&
-
- git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
- done &&
- cp -r log-* output-* /tmp/foo/ &&
-
- test_cmp output-hg output-git &&
- test_cmp log-hg log-git
-'
-
-test_expect_success 'symlink' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- ln -s alpha beta &&
- git add beta &&
- git commit -m "add beta"
- ) &&
-
- for x in hg git; do
- (
- hg_clone_$x gitrepo hgrepo-$x &&
- cd hgrepo-$x &&
- hg_log . &&
- hg manifest -v
- ) > output-$x &&
-
- git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
- done &&
-
- test_cmp output-hg output-git &&
- test_cmp log-hg log-git
-'
-
-test_expect_success 'merge conflict 1' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- hg init hgrepo1 &&
- cd hgrepo1 &&
- echo A > afile &&
- hg add afile &&
- hg ci -m "origin" &&
-
- echo B > afile &&
- hg ci -m "A->B" &&
-
- hg up -r0 &&
- echo C > afile &&
- hg ci -m "A->C" &&
-
- hg merge -r1 || true &&
- echo C > afile &&
- hg resolve -m afile &&
- hg ci -m "merge to C"
- ) &&
-
- for x in hg git; do
- git_clone_$x hgrepo1 gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'merge conflict 2' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- hg init hgrepo1 &&
- cd hgrepo1 &&
- echo A > afile &&
- hg add afile &&
- hg ci -m "origin" &&
-
- echo B > afile &&
- hg ci -m "A->B" &&
-
- hg up -r0 &&
- echo C > afile &&
- hg ci -m "A->C" &&
-
- hg merge -r1 || true &&
- echo B > afile &&
- hg resolve -m afile &&
- hg ci -m "merge to B"
- ) &&
-
- for x in hg git; do
- git_clone_$x hgrepo1 gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'converged merge' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- hg init hgrepo1 &&
- cd hgrepo1 &&
- echo A > afile &&
- hg add afile &&
- hg ci -m "origin" &&
-
- echo B > afile &&
- hg ci -m "A->B" &&
-
- echo C > afile &&
- hg ci -m "B->C" &&
-
- hg up -r0 &&
- echo C > afile &&
- hg ci -m "A->C" &&
-
- hg merge -r2 || true &&
- hg ci -m "merge"
- ) &&
-
- for x in hg git; do
- git_clone_$x hgrepo1 gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'encoding' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add älphà" &&
-
- export GIT_AUTHOR_NAME="tést èncödîng" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
-
- echo gamma > gamma &&
- git add gamma &&
- git commit -m "add gämmâ" &&
-
- : TODO git config i18n.commitencoding latin-1 &&
- echo delta > delta &&
- git add delta &&
- git commit -m "add déltà"
- ) &&
-
- for x in hg git; do
- hg_clone_$x gitrepo hgrepo-$x &&
- git_clone_$x hgrepo-$x gitrepo2-$x &&
-
- HGENCODING=utf-8 hg_log hgrepo-$x > hg-log-$x &&
- git_log gitrepo2-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'file removal' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta"
- mkdir foo &&
- echo blah > foo/bar &&
- git add foo &&
- git commit -m "add foo" &&
- git rm alpha &&
- git commit -m "remove alpha" &&
- git rm foo/bar &&
- git commit -m "remove foo/bar"
- ) &&
-
- for x in hg git; do
- (
- hg_clone_$x gitrepo hgrepo-$x &&
- cd hgrepo-$x &&
- hg_log . &&
- hg manifest -r 3 &&
- hg manifest
- ) > output-$x &&
-
- git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
- done &&
-
- test_cmp output-hg output-git &&
- test_cmp log-hg log-git
-'
-
-test_expect_success 'git tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- git config receive.denyCurrentBranch ignore &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git tag alpha &&
-
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
- git tag -a -m "added tag beta" beta
- ) &&
-
- for x in hg git; do
- hg_clone_$x gitrepo hgrepo-$x &&
- hg_log hgrepo-$x > log-$x
- done &&
-
- test_cmp log-hg log-git
-'
-
-test_expect_success 'hg author' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- for x in hg git; do
- (
- git init -q gitrepo-$x &&
- cd gitrepo-$x &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone_$x gitrepo-$x hgrepo-$x &&
- cd hgrepo-$x &&
-
- hg co master &&
- echo beta > beta &&
- hg add beta &&
- hg commit -u "test" -m "add beta" &&
-
- echo gamma >> beta &&
- hg commit -u "test <test@example.com> (comment)" -m "modify beta" &&
-
- echo gamma > gamma &&
- hg add gamma &&
- hg commit -u "<test@example.com>" -m "add gamma" &&
-
- echo delta > delta &&
- hg add delta &&
- hg commit -u "name<test@example.com>" -m "add delta" &&
-
- echo epsilon > epsilon &&
- hg add epsilon &&
- hg commit -u "name <test@example.com" -m "add epsilon" &&
-
- echo zeta > zeta &&
- hg add zeta &&
- hg commit -u " test " -m "add zeta" &&
-
- echo eta > eta &&
- hg add eta &&
- hg commit -u "test < test@example.com >" -m "add eta" &&
-
- echo theta > theta &&
- hg add theta &&
- hg commit -u "test >test@example.com>" -m "add theta" &&
-
- echo iota > iota &&
- hg add iota &&
- hg commit -u "test <test <at> example <dot> com>" -m "add iota"
- ) &&
-
- hg_push_$x hgrepo-$x gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
-
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp git-log-hg git-log-git &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'hg branch' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- for x in hg git; do
- (
- git init -q gitrepo-$x &&
- cd gitrepo-$x &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -q -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone_$x gitrepo-$x hgrepo-$x &&
-
- cd hgrepo-$x &&
- hg -q co master &&
- hg mv alpha beta &&
- hg -q commit -m "rename alpha to beta" &&
- hg branch gamma | grep -v "permanent and global" &&
- hg -q commit -m "started branch gamma"
- ) &&
-
- hg_push_$x hgrepo-$x gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
-
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'hg tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- for x in hg git; do
- (
- git init -q gitrepo-$x &&
- cd gitrepo-$x &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone_$x gitrepo-$x hgrepo-$x &&
-
- cd hgrepo-$x &&
- hg co master &&
- hg tag alpha
- ) &&
-
- hg_push_$x hgrepo-$x gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
-
- (
- git --git-dir=gitrepo-$x/.git tag -l &&
- hg_log hgrepo2-$x &&
- cat hgrepo2-$x/.hgtags
- ) > output-$x
- done &&
-
- test_cmp output-hg output-git
-'
-
-test_done
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
deleted file mode 100755
index 5f81dfa..0000000
--- a/contrib/remote-helpers/test-hg.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-# Base commands from hg-git tests:
-# https://bitbucket.org/durin42/hg-git/src
-#
-
-test_description='Test remote-hg'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-hg tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
- skip_all='skipping remote-hg tests; mercurial not available'
- test_done
-fi
-
-check () {
- (cd $1 &&
- git log --format='%s' -1 &&
- git symbolic-ref HEAD) > actual &&
- (echo $2 &&
- echo "refs/heads/$3") > expected &&
- test_cmp expected actual
-}
-
-setup () {
- (
- echo "[ui]"
- echo "username = H G Wells <wells@example.com>"
- ) >> "$HOME"/.hgrc
-}
-
-setup
-
-test_expect_success 'cloning' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- hg init hgrepo &&
- cd hgrepo &&
- echo zero > content &&
- hg add content &&
- hg commit -m zero
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo zero master
-'
-
-test_expect_success 'cloning with branches' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg branch next &&
- echo next > content &&
- hg commit -m next
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo next next &&
-
- (cd hgrepo && hg checkout default) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo2 &&
- check gitrepo2 zero master
-'
-
-test_expect_success 'cloning with bookmarks' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg bookmark feature-a &&
- echo feature-a > content &&
- hg commit -m feature-a
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo feature-a feature-a
-'
-
-test_expect_success 'cloning with detached head' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg update -r 0
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo zero master
-'
-
-test_expect_success 'update bookmark' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg bookmark devel
- ) &&
-
- (
- git clone "hg::$PWD/hgrepo" gitrepo &&
- cd gitrepo &&
- git checkout devel &&
- echo devel > content &&
- git commit -a -m devel &&
- git push
- ) &&
-
- hg -R hgrepo bookmarks | grep "devel\s\+3:"
-'
-
-test_done
diff --git a/t/Makefile b/t/Makefile
index 1923cc1..612fe79 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -48,7 +48,7 @@ clean: clean-except-prove-cache
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
test-lint-duplicates:
- @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
+ @dups=`echo $(T) $(TDUP) | tr ' ' '\n' | sed -ne 's|\(.*/\)*t\([0-9][0-9][0-9][0-9]\)-.*|\2|p' | sort | uniq -d` && \
test -z "$$dups" || { \
echo >&2 "duplicate test numbers:" $$dups; exit 1; }
--
1.8.1.1
^ permalink raw reply related
* [RFC] test-lint-duplicates: check numbering in contrib/remote-helpers
From: Torsten Bögershausen @ 2013-01-25 22:34 UTC (permalink / raw)
To: git; +Cc: tboegi
Running make inside contrib/remote-helpers failes in "test-lint-duplicates"
This was because the regexp to check for duplicate numbers strips everything
after the first "-" in the filename, including the prefix.
As a result, 2 pathnames like
"xxxx/contrib/remote-helpers/test-bzr.sh" and
"xxxx/contrib/remote-helpers/test-hg-bidi.sh"
are both converted into
"xxxx/contrib/remote" and reported as duplicate.
Improve the regexp:
Remove everything after "tNNNN-" (where X stand for a digit)
Rename the tests in contrib/remote-helpers into
t5810-test-bzr.sh,
t5820-test-hg-bidi.sh,
t5821-test-hg-hg-git.sh,
t5830-test-hg.sh
Feed the numbers used in contrib/remote-helpers into t/Makefile
and check that the numbering is unique across both directories
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
contrib/remote-helpers/Makefile | 3 +-
contrib/remote-helpers/t5810-test-bzr.sh | 143 +++++++
contrib/remote-helpers/t5820-test-hg-bidi.sh | 243 +++++++++++
contrib/remote-helpers/t5821-test-hg-hg-git.sh | 534 +++++++++++++++++++++++++
contrib/remote-helpers/t5830-test-hg.sh | 121 ++++++
contrib/remote-helpers/test-bzr.sh | 143 -------
contrib/remote-helpers/test-hg-bidi.sh | 243 -----------
contrib/remote-helpers/test-hg-hg-git.sh | 534 -------------------------
contrib/remote-helpers/test-hg.sh | 121 ------
t/Makefile | 2 +-
10 files changed, 1044 insertions(+), 1043 deletions(-)
create mode 100755 contrib/remote-helpers/t5810-test-bzr.sh
create mode 100755 contrib/remote-helpers/t5820-test-hg-bidi.sh
create mode 100755 contrib/remote-helpers/t5821-test-hg-hg-git.sh
create mode 100755 contrib/remote-helpers/t5830-test-hg.sh
delete mode 100755 contrib/remote-helpers/test-bzr.sh
delete mode 100755 contrib/remote-helpers/test-hg-bidi.sh
delete mode 100755 contrib/remote-helpers/test-hg-hg-git.sh
delete mode 100755 contrib/remote-helpers/test-hg.sh
diff --git a/contrib/remote-helpers/Makefile b/contrib/remote-helpers/Makefile
index 9a76575..012ad50 100644
--- a/contrib/remote-helpers/Makefile
+++ b/contrib/remote-helpers/Makefile
@@ -1,6 +1,7 @@
-TESTS := $(wildcard test*.sh)
+TESTS := $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
export T := $(addprefix $(CURDIR)/,$(TESTS))
+export TDUP := $(sort $(wildcard ../../t/t[0-9][0-9][0-9][0-9]-*.sh))
export MAKE := $(MAKE) -e
export PATH := $(CURDIR):$(PATH)
diff --git a/contrib/remote-helpers/t5810-test-bzr.sh b/contrib/remote-helpers/t5810-test-bzr.sh
new file mode 100755
index 0000000..70aa8a0
--- /dev/null
+++ b/contrib/remote-helpers/t5810-test-bzr.sh
@@ -0,0 +1,143 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+
+test_description='Test remote-bzr'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-bzr tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import bzrlib'; then
+ skip_all='skipping remote-bzr tests; bzr not available'
+ test_done
+fi
+
+cmd='
+import bzrlib
+bzrlib.initialize()
+import bzrlib.plugin
+bzrlib.plugin.load_plugins()
+import bzrlib.plugins.fastimport
+'
+
+if ! "$PYTHON_PATH" -c "$cmd"; then
+ echo "consider setting BZR_PLUGIN_PATH=$HOME/.bazaar/plugins" 1>&2
+ skip_all='skipping remote-bzr tests; bzr-fastimport not available'
+ test_done
+fi
+
+check () {
+ (cd $1 &&
+ git log --format='%s' -1 &&
+ git symbolic-ref HEAD) > actual &&
+ (echo $2 &&
+ echo "refs/heads/$3") > expected &&
+ test_cmp expected actual
+}
+
+bzr whoami "A U Thor <author@example.com>"
+
+test_expect_success 'cloning' '
+ (bzr init bzrrepo &&
+ cd bzrrepo &&
+ echo one > content &&
+ bzr add content &&
+ bzr commit -m one
+ ) &&
+
+ git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ check gitrepo one master
+'
+
+test_expect_success 'pulling' '
+ (cd bzrrepo &&
+ echo two > content &&
+ bzr commit -m two
+ ) &&
+
+ (cd gitrepo && git pull) &&
+
+ check gitrepo two master
+'
+
+test_expect_success 'pushing' '
+ (cd gitrepo &&
+ echo three > content &&
+ git commit -a -m three &&
+ git push
+ ) &&
+
+ echo three > expected &&
+ cat bzrrepo/content > actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'roundtrip' '
+ (cd gitrepo &&
+ git pull &&
+ git log --format="%s" -1 origin/master > actual) &&
+ echo three > expected &&
+ test_cmp expected actual &&
+
+ (cd gitrepo && git push && git pull) &&
+
+ (cd bzrrepo &&
+ echo four > content &&
+ bzr commit -m four
+ ) &&
+
+ (cd gitrepo && git pull && git push) &&
+
+ check gitrepo four master &&
+
+ (cd gitrepo &&
+ echo five > content &&
+ git commit -a -m five &&
+ git push && git pull
+ ) &&
+
+ (cd bzrrepo && bzr revert) &&
+
+ echo five > expected &&
+ cat bzrrepo/content > actual &&
+ test_cmp expected actual
+'
+
+cat > expected <<EOF
+100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
+100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
+120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
+EOF
+
+test_expect_success 'special modes' '
+ (cd bzrrepo &&
+ echo exec > executable
+ chmod +x executable &&
+ bzr add executable
+ bzr commit -m exec &&
+ ln -s content link
+ bzr add link
+ bzr commit -m link &&
+ mkdir dir &&
+ bzr add dir &&
+ bzr commit -m dir) &&
+
+ (cd gitrepo &&
+ git pull
+ git ls-tree HEAD > ../actual) &&
+
+ test_cmp expected actual &&
+
+ (cd gitrepo &&
+ git cat-file -p HEAD:link > ../actual) &&
+
+ echo -n content > expected &&
+ test_cmp expected actual
+'
+
+test_done
diff --git a/contrib/remote-helpers/t5820-test-hg-bidi.sh b/contrib/remote-helpers/t5820-test-hg-bidi.sh
new file mode 100755
index 0000000..1d61982
--- /dev/null
+++ b/contrib/remote-helpers/t5820-test-hg-bidi.sh
@@ -0,0 +1,243 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+# Base commands from hg-git tests:
+# https://bitbucket.org/durin42/hg-git/src
+#
+
+test_description='Test bidirectionality of remote-hg'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-hg tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import mercurial'; then
+ skip_all='skipping remote-hg tests; mercurial not available'
+ test_done
+fi
+
+# clone to a git repo
+git_clone () {
+ hg -R $1 bookmark -f -r tip master &&
+ git clone -q "hg::$PWD/$1" $2
+}
+
+# clone to an hg repo
+hg_clone () {
+ (
+ hg init $2 &&
+ cd $1 &&
+ git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
+ ) &&
+
+ (cd $2 && hg -q update)
+}
+
+# push an hg repo
+hg_push () {
+ (
+ cd $2
+ old=$(git symbolic-ref --short HEAD)
+ git checkout -q -b tmp &&
+ git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
+ git checkout -q $old &&
+ git branch -q -D tmp 2> /dev/null || true
+ )
+}
+
+hg_log () {
+ hg -R $1 log --graph --debug | grep -v 'tag: *default/'
+}
+
+setup () {
+ (
+ echo "[ui]"
+ echo "username = A U Thor <author@example.com>"
+ echo "[defaults]"
+ echo "backout = -d \"0 0\""
+ echo "commit = -d \"0 0\""
+ echo "debugrawcommit = -d \"0 0\""
+ echo "tag = -d \"0 0\""
+ ) >> "$HOME"/.hgrc &&
+ git config --global remote-hg.hg-git-compat true
+
+ export HGEDITOR=/usr/bin/true
+
+ export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+}
+
+setup
+
+test_expect_success 'encoding' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add älphà" &&
+
+ export GIT_AUTHOR_NAME="tést èncödîng" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+
+ echo gamma > gamma &&
+ git add gamma &&
+ git commit -m "add gämmâ" &&
+
+ : TODO git config i18n.commitencoding latin-1 &&
+ echo delta > delta &&
+ git add delta &&
+ git commit -m "add déltà"
+ ) &&
+
+ hg_clone gitrepo hgrepo &&
+ git_clone hgrepo gitrepo2 &&
+ hg_clone gitrepo2 hgrepo2 &&
+
+ HGENCODING=utf-8 hg_log hgrepo > expected &&
+ HGENCODING=utf-8 hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'file removal' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta"
+ mkdir foo &&
+ echo blah > foo/bar &&
+ git add foo &&
+ git commit -m "add foo" &&
+ git rm alpha &&
+ git commit -m "remove alpha" &&
+ git rm foo/bar &&
+ git commit -m "remove foo/bar"
+ ) &&
+
+ hg_clone gitrepo hgrepo &&
+ git_clone hgrepo gitrepo2 &&
+ hg_clone gitrepo2 hgrepo2 &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'git tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ git config receive.denyCurrentBranch ignore &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git tag alpha &&
+
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+ git tag -a -m "added tag beta" beta
+ ) &&
+
+ hg_clone gitrepo hgrepo &&
+ git_clone hgrepo gitrepo2 &&
+ hg_clone gitrepo2 hgrepo2 &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'hg branch' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -q -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone gitrepo hgrepo &&
+
+ cd hgrepo &&
+ hg -q co master &&
+ hg mv alpha beta &&
+ hg -q commit -m "rename alpha to beta" &&
+ hg branch gamma | grep -v "permanent and global" &&
+ hg -q commit -m "started branch gamma"
+ ) &&
+
+ hg_push hgrepo gitrepo &&
+ hg_clone gitrepo hgrepo2 &&
+
+ : TODO, avoid "master" bookmark &&
+ (cd hgrepo2 && hg checkout gamma) &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_expect_success 'hg tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone gitrepo hgrepo &&
+
+ cd hgrepo &&
+ hg co master &&
+ hg tag alpha
+ ) &&
+
+ hg_push hgrepo gitrepo &&
+ hg_clone gitrepo hgrepo2 &&
+
+ hg_log hgrepo > expected &&
+ hg_log hgrepo2 > actual &&
+
+ test_cmp expected actual
+'
+
+test_done
diff --git a/contrib/remote-helpers/t5821-test-hg-hg-git.sh b/contrib/remote-helpers/t5821-test-hg-hg-git.sh
new file mode 100755
index 0000000..7e3967f
--- /dev/null
+++ b/contrib/remote-helpers/t5821-test-hg-hg-git.sh
@@ -0,0 +1,534 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+# Base commands from hg-git tests:
+# https://bitbucket.org/durin42/hg-git/src
+#
+
+test_description='Test remote-hg output compared to hg-git'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-hg tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import mercurial'; then
+ skip_all='skipping remote-hg tests; mercurial not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import hggit'; then
+ skip_all='skipping remote-hg tests; hg-git not available'
+ test_done
+fi
+
+# clone to a git repo with git
+git_clone_git () {
+ hg -R $1 bookmark -f -r tip master &&
+ git clone -q "hg::$PWD/$1" $2
+}
+
+# clone to an hg repo with git
+hg_clone_git () {
+ (
+ hg init $2 &&
+ cd $1 &&
+ git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
+ ) &&
+
+ (cd $2 && hg -q update)
+}
+
+# clone to a git repo with hg
+git_clone_hg () {
+ (
+ git init -q $2 &&
+ cd $1 &&
+ hg bookmark -f -r tip master &&
+ hg -q push -r master ../$2 || true
+ )
+}
+
+# clone to an hg repo with hg
+hg_clone_hg () {
+ hg -q clone $1 $2
+}
+
+# push an hg repo with git
+hg_push_git () {
+ (
+ cd $2
+ old=$(git symbolic-ref --short HEAD)
+ git checkout -q -b tmp &&
+ git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
+ git checkout -q $old &&
+ git branch -q -D tmp 2> /dev/null || true
+ )
+}
+
+# push an hg git repo with hg
+hg_push_hg () {
+ (
+ cd $1 &&
+ hg -q push ../$2 || true
+ )
+}
+
+hg_log () {
+ hg -R $1 log --graph --debug | grep -v 'tag: *default/'
+}
+
+git_log () {
+ git --git-dir=$1/.git fast-export --branches
+}
+
+setup () {
+ (
+ echo "[ui]"
+ echo "username = A U Thor <author@example.com>"
+ echo "[defaults]"
+ echo "backout = -d \"0 0\""
+ echo "commit = -d \"0 0\""
+ echo "debugrawcommit = -d \"0 0\""
+ echo "tag = -d \"0 0\""
+ echo "[extensions]"
+ echo "hgext.bookmarks ="
+ echo "hggit ="
+ ) >> "$HOME"/.hgrc &&
+ git config --global receive.denycurrentbranch warn
+ git config --global remote-hg.hg-git-compat true
+
+ export HGEDITOR=/usr/bin/true
+
+ export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+}
+
+setup
+
+test_expect_success 'executable bit' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ chmod 0644 alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ chmod 0755 alpha &&
+ git add alpha &&
+ git commit -m "set executable bit" &&
+ chmod 0644 alpha &&
+ git add alpha &&
+ git commit -m "clear executable bit"
+ ) &&
+
+ for x in hg git; do
+ (
+ hg_clone_$x gitrepo hgrepo-$x &&
+ cd hgrepo-$x &&
+ hg_log . &&
+ hg manifest -r 1 -v &&
+ hg manifest -v
+ ) > output-$x &&
+
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+ git_log gitrepo2-$x > log-$x
+ done &&
+ cp -r log-* output-* /tmp/foo/ &&
+
+ test_cmp output-hg output-git &&
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'symlink' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ ln -s alpha beta &&
+ git add beta &&
+ git commit -m "add beta"
+ ) &&
+
+ for x in hg git; do
+ (
+ hg_clone_$x gitrepo hgrepo-$x &&
+ cd hgrepo-$x &&
+ hg_log . &&
+ hg manifest -v
+ ) > output-$x &&
+
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+ git_log gitrepo2-$x > log-$x
+ done &&
+
+ test_cmp output-hg output-git &&
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'merge conflict 1' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ hg init hgrepo1 &&
+ cd hgrepo1 &&
+ echo A > afile &&
+ hg add afile &&
+ hg ci -m "origin" &&
+
+ echo B > afile &&
+ hg ci -m "A->B" &&
+
+ hg up -r0 &&
+ echo C > afile &&
+ hg ci -m "A->C" &&
+
+ hg merge -r1 || true &&
+ echo C > afile &&
+ hg resolve -m afile &&
+ hg ci -m "merge to C"
+ ) &&
+
+ for x in hg git; do
+ git_clone_$x hgrepo1 gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'merge conflict 2' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ hg init hgrepo1 &&
+ cd hgrepo1 &&
+ echo A > afile &&
+ hg add afile &&
+ hg ci -m "origin" &&
+
+ echo B > afile &&
+ hg ci -m "A->B" &&
+
+ hg up -r0 &&
+ echo C > afile &&
+ hg ci -m "A->C" &&
+
+ hg merge -r1 || true &&
+ echo B > afile &&
+ hg resolve -m afile &&
+ hg ci -m "merge to B"
+ ) &&
+
+ for x in hg git; do
+ git_clone_$x hgrepo1 gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'converged merge' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ hg init hgrepo1 &&
+ cd hgrepo1 &&
+ echo A > afile &&
+ hg add afile &&
+ hg ci -m "origin" &&
+
+ echo B > afile &&
+ hg ci -m "A->B" &&
+
+ echo C > afile &&
+ hg ci -m "B->C" &&
+
+ hg up -r0 &&
+ echo C > afile &&
+ hg ci -m "A->C" &&
+
+ hg merge -r2 || true &&
+ hg ci -m "merge"
+ ) &&
+
+ for x in hg git; do
+ git_clone_$x hgrepo1 gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'encoding' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add älphà" &&
+
+ export GIT_AUTHOR_NAME="tést èncödîng" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+
+ echo gamma > gamma &&
+ git add gamma &&
+ git commit -m "add gämmâ" &&
+
+ : TODO git config i18n.commitencoding latin-1 &&
+ echo delta > delta &&
+ git add delta &&
+ git commit -m "add déltà"
+ ) &&
+
+ for x in hg git; do
+ hg_clone_$x gitrepo hgrepo-$x &&
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+
+ HGENCODING=utf-8 hg_log hgrepo-$x > hg-log-$x &&
+ git_log gitrepo2-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'file removal' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta"
+ mkdir foo &&
+ echo blah > foo/bar &&
+ git add foo &&
+ git commit -m "add foo" &&
+ git rm alpha &&
+ git commit -m "remove alpha" &&
+ git rm foo/bar &&
+ git commit -m "remove foo/bar"
+ ) &&
+
+ for x in hg git; do
+ (
+ hg_clone_$x gitrepo hgrepo-$x &&
+ cd hgrepo-$x &&
+ hg_log . &&
+ hg manifest -r 3 &&
+ hg manifest
+ ) > output-$x &&
+
+ git_clone_$x hgrepo-$x gitrepo2-$x &&
+ git_log gitrepo2-$x > log-$x
+ done &&
+
+ test_cmp output-hg output-git &&
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'git tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ git init -q gitrepo &&
+ cd gitrepo &&
+ git config receive.denyCurrentBranch ignore &&
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git tag alpha &&
+
+ echo beta > beta &&
+ git add beta &&
+ git commit -m "add beta" &&
+ git tag -a -m "added tag beta" beta
+ ) &&
+
+ for x in hg git; do
+ hg_clone_$x gitrepo hgrepo-$x &&
+ hg_log hgrepo-$x > log-$x
+ done &&
+
+ test_cmp log-hg log-git
+'
+
+test_expect_success 'hg author' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ for x in hg git; do
+ (
+ git init -q gitrepo-$x &&
+ cd gitrepo-$x &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone_$x gitrepo-$x hgrepo-$x &&
+ cd hgrepo-$x &&
+
+ hg co master &&
+ echo beta > beta &&
+ hg add beta &&
+ hg commit -u "test" -m "add beta" &&
+
+ echo gamma >> beta &&
+ hg commit -u "test <test@example.com> (comment)" -m "modify beta" &&
+
+ echo gamma > gamma &&
+ hg add gamma &&
+ hg commit -u "<test@example.com>" -m "add gamma" &&
+
+ echo delta > delta &&
+ hg add delta &&
+ hg commit -u "name<test@example.com>" -m "add delta" &&
+
+ echo epsilon > epsilon &&
+ hg add epsilon &&
+ hg commit -u "name <test@example.com" -m "add epsilon" &&
+
+ echo zeta > zeta &&
+ hg add zeta &&
+ hg commit -u " test " -m "add zeta" &&
+
+ echo eta > eta &&
+ hg add eta &&
+ hg commit -u "test < test@example.com >" -m "add eta" &&
+
+ echo theta > theta &&
+ hg add theta &&
+ hg commit -u "test >test@example.com>" -m "add theta" &&
+
+ echo iota > iota &&
+ hg add iota &&
+ hg commit -u "test <test <at> example <dot> com>" -m "add iota"
+ ) &&
+
+ hg_push_$x hgrepo-$x gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp git-log-hg git-log-git &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'hg branch' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ for x in hg git; do
+ (
+ git init -q gitrepo-$x &&
+ cd gitrepo-$x &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -q -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone_$x gitrepo-$x hgrepo-$x &&
+
+ cd hgrepo-$x &&
+ hg -q co master &&
+ hg mv alpha beta &&
+ hg -q commit -m "rename alpha to beta" &&
+ hg branch gamma | grep -v "permanent and global" &&
+ hg -q commit -m "started branch gamma"
+ ) &&
+
+ hg_push_$x hgrepo-$x gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+
+ hg_log hgrepo2-$x > hg-log-$x &&
+ git_log gitrepo-$x > git-log-$x
+ done &&
+
+ test_cmp hg-log-hg hg-log-git &&
+ test_cmp git-log-hg git-log-git
+'
+
+test_expect_success 'hg tags' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ for x in hg git; do
+ (
+ git init -q gitrepo-$x &&
+ cd gitrepo-$x &&
+
+ echo alpha > alpha &&
+ git add alpha &&
+ git commit -m "add alpha" &&
+ git checkout -q -b not-master
+ ) &&
+
+ (
+ hg_clone_$x gitrepo-$x hgrepo-$x &&
+
+ cd hgrepo-$x &&
+ hg co master &&
+ hg tag alpha
+ ) &&
+
+ hg_push_$x hgrepo-$x gitrepo-$x &&
+ hg_clone_$x gitrepo-$x hgrepo2-$x &&
+
+ (
+ git --git-dir=gitrepo-$x/.git tag -l &&
+ hg_log hgrepo2-$x &&
+ cat hgrepo2-$x/.hgtags
+ ) > output-$x
+ done &&
+
+ test_cmp output-hg output-git
+'
+
+test_done
diff --git a/contrib/remote-helpers/t5830-test-hg.sh b/contrib/remote-helpers/t5830-test-hg.sh
new file mode 100755
index 0000000..5f81dfa
--- /dev/null
+++ b/contrib/remote-helpers/t5830-test-hg.sh
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+# Base commands from hg-git tests:
+# https://bitbucket.org/durin42/hg-git/src
+#
+
+test_description='Test remote-hg'
+
+. ./test-lib.sh
+
+if ! test_have_prereq PYTHON; then
+ skip_all='skipping remote-hg tests; python not available'
+ test_done
+fi
+
+if ! "$PYTHON_PATH" -c 'import mercurial'; then
+ skip_all='skipping remote-hg tests; mercurial not available'
+ test_done
+fi
+
+check () {
+ (cd $1 &&
+ git log --format='%s' -1 &&
+ git symbolic-ref HEAD) > actual &&
+ (echo $2 &&
+ echo "refs/heads/$3") > expected &&
+ test_cmp expected actual
+}
+
+setup () {
+ (
+ echo "[ui]"
+ echo "username = H G Wells <wells@example.com>"
+ ) >> "$HOME"/.hgrc
+}
+
+setup
+
+test_expect_success 'cloning' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ hg init hgrepo &&
+ cd hgrepo &&
+ echo zero > content &&
+ hg add content &&
+ hg commit -m zero
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo zero master
+'
+
+test_expect_success 'cloning with branches' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg branch next &&
+ echo next > content &&
+ hg commit -m next
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo next next &&
+
+ (cd hgrepo && hg checkout default) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo2 &&
+ check gitrepo2 zero master
+'
+
+test_expect_success 'cloning with bookmarks' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg bookmark feature-a &&
+ echo feature-a > content &&
+ hg commit -m feature-a
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo feature-a feature-a
+'
+
+test_expect_success 'cloning with detached head' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg update -r 0
+ ) &&
+
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ check gitrepo zero master
+'
+
+test_expect_success 'update bookmark' '
+ test_when_finished "rm -rf gitrepo*" &&
+
+ (
+ cd hgrepo &&
+ hg bookmark devel
+ ) &&
+
+ (
+ git clone "hg::$PWD/hgrepo" gitrepo &&
+ cd gitrepo &&
+ git checkout devel &&
+ echo devel > content &&
+ git commit -a -m devel &&
+ git push
+ ) &&
+
+ hg -R hgrepo bookmarks | grep "devel\s\+3:"
+'
+
+test_done
diff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.sh
deleted file mode 100755
index 70aa8a0..0000000
--- a/contrib/remote-helpers/test-bzr.sh
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-
-test_description='Test remote-bzr'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-bzr tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import bzrlib'; then
- skip_all='skipping remote-bzr tests; bzr not available'
- test_done
-fi
-
-cmd='
-import bzrlib
-bzrlib.initialize()
-import bzrlib.plugin
-bzrlib.plugin.load_plugins()
-import bzrlib.plugins.fastimport
-'
-
-if ! "$PYTHON_PATH" -c "$cmd"; then
- echo "consider setting BZR_PLUGIN_PATH=$HOME/.bazaar/plugins" 1>&2
- skip_all='skipping remote-bzr tests; bzr-fastimport not available'
- test_done
-fi
-
-check () {
- (cd $1 &&
- git log --format='%s' -1 &&
- git symbolic-ref HEAD) > actual &&
- (echo $2 &&
- echo "refs/heads/$3") > expected &&
- test_cmp expected actual
-}
-
-bzr whoami "A U Thor <author@example.com>"
-
-test_expect_success 'cloning' '
- (bzr init bzrrepo &&
- cd bzrrepo &&
- echo one > content &&
- bzr add content &&
- bzr commit -m one
- ) &&
-
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
- check gitrepo one master
-'
-
-test_expect_success 'pulling' '
- (cd bzrrepo &&
- echo two > content &&
- bzr commit -m two
- ) &&
-
- (cd gitrepo && git pull) &&
-
- check gitrepo two master
-'
-
-test_expect_success 'pushing' '
- (cd gitrepo &&
- echo three > content &&
- git commit -a -m three &&
- git push
- ) &&
-
- echo three > expected &&
- cat bzrrepo/content > actual &&
- test_cmp expected actual
-'
-
-test_expect_success 'roundtrip' '
- (cd gitrepo &&
- git pull &&
- git log --format="%s" -1 origin/master > actual) &&
- echo three > expected &&
- test_cmp expected actual &&
-
- (cd gitrepo && git push && git pull) &&
-
- (cd bzrrepo &&
- echo four > content &&
- bzr commit -m four
- ) &&
-
- (cd gitrepo && git pull && git push) &&
-
- check gitrepo four master &&
-
- (cd gitrepo &&
- echo five > content &&
- git commit -a -m five &&
- git push && git pull
- ) &&
-
- (cd bzrrepo && bzr revert) &&
-
- echo five > expected &&
- cat bzrrepo/content > actual &&
- test_cmp expected actual
-'
-
-cat > expected <<EOF
-100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
-100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
-120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
-EOF
-
-test_expect_success 'special modes' '
- (cd bzrrepo &&
- echo exec > executable
- chmod +x executable &&
- bzr add executable
- bzr commit -m exec &&
- ln -s content link
- bzr add link
- bzr commit -m link &&
- mkdir dir &&
- bzr add dir &&
- bzr commit -m dir) &&
-
- (cd gitrepo &&
- git pull
- git ls-tree HEAD > ../actual) &&
-
- test_cmp expected actual &&
-
- (cd gitrepo &&
- git cat-file -p HEAD:link > ../actual) &&
-
- echo -n content > expected &&
- test_cmp expected actual
-'
-
-test_done
diff --git a/contrib/remote-helpers/test-hg-bidi.sh b/contrib/remote-helpers/test-hg-bidi.sh
deleted file mode 100755
index 1d61982..0000000
--- a/contrib/remote-helpers/test-hg-bidi.sh
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-# Base commands from hg-git tests:
-# https://bitbucket.org/durin42/hg-git/src
-#
-
-test_description='Test bidirectionality of remote-hg'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-hg tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
- skip_all='skipping remote-hg tests; mercurial not available'
- test_done
-fi
-
-# clone to a git repo
-git_clone () {
- hg -R $1 bookmark -f -r tip master &&
- git clone -q "hg::$PWD/$1" $2
-}
-
-# clone to an hg repo
-hg_clone () {
- (
- hg init $2 &&
- cd $1 &&
- git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
- ) &&
-
- (cd $2 && hg -q update)
-}
-
-# push an hg repo
-hg_push () {
- (
- cd $2
- old=$(git symbolic-ref --short HEAD)
- git checkout -q -b tmp &&
- git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
- git checkout -q $old &&
- git branch -q -D tmp 2> /dev/null || true
- )
-}
-
-hg_log () {
- hg -R $1 log --graph --debug | grep -v 'tag: *default/'
-}
-
-setup () {
- (
- echo "[ui]"
- echo "username = A U Thor <author@example.com>"
- echo "[defaults]"
- echo "backout = -d \"0 0\""
- echo "commit = -d \"0 0\""
- echo "debugrawcommit = -d \"0 0\""
- echo "tag = -d \"0 0\""
- ) >> "$HOME"/.hgrc &&
- git config --global remote-hg.hg-git-compat true
-
- export HGEDITOR=/usr/bin/true
-
- export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
- export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
-}
-
-setup
-
-test_expect_success 'encoding' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add älphà" &&
-
- export GIT_AUTHOR_NAME="tést èncödîng" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
-
- echo gamma > gamma &&
- git add gamma &&
- git commit -m "add gämmâ" &&
-
- : TODO git config i18n.commitencoding latin-1 &&
- echo delta > delta &&
- git add delta &&
- git commit -m "add déltà"
- ) &&
-
- hg_clone gitrepo hgrepo &&
- git_clone hgrepo gitrepo2 &&
- hg_clone gitrepo2 hgrepo2 &&
-
- HGENCODING=utf-8 hg_log hgrepo > expected &&
- HGENCODING=utf-8 hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'file removal' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta"
- mkdir foo &&
- echo blah > foo/bar &&
- git add foo &&
- git commit -m "add foo" &&
- git rm alpha &&
- git commit -m "remove alpha" &&
- git rm foo/bar &&
- git commit -m "remove foo/bar"
- ) &&
-
- hg_clone gitrepo hgrepo &&
- git_clone hgrepo gitrepo2 &&
- hg_clone gitrepo2 hgrepo2 &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'git tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- git config receive.denyCurrentBranch ignore &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git tag alpha &&
-
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
- git tag -a -m "added tag beta" beta
- ) &&
-
- hg_clone gitrepo hgrepo &&
- git_clone hgrepo gitrepo2 &&
- hg_clone gitrepo2 hgrepo2 &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'hg branch' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -q -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone gitrepo hgrepo &&
-
- cd hgrepo &&
- hg -q co master &&
- hg mv alpha beta &&
- hg -q commit -m "rename alpha to beta" &&
- hg branch gamma | grep -v "permanent and global" &&
- hg -q commit -m "started branch gamma"
- ) &&
-
- hg_push hgrepo gitrepo &&
- hg_clone gitrepo hgrepo2 &&
-
- : TODO, avoid "master" bookmark &&
- (cd hgrepo2 && hg checkout gamma) &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_expect_success 'hg tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone gitrepo hgrepo &&
-
- cd hgrepo &&
- hg co master &&
- hg tag alpha
- ) &&
-
- hg_push hgrepo gitrepo &&
- hg_clone gitrepo hgrepo2 &&
-
- hg_log hgrepo > expected &&
- hg_log hgrepo2 > actual &&
-
- test_cmp expected actual
-'
-
-test_done
diff --git a/contrib/remote-helpers/test-hg-hg-git.sh b/contrib/remote-helpers/test-hg-hg-git.sh
deleted file mode 100755
index 7e3967f..0000000
--- a/contrib/remote-helpers/test-hg-hg-git.sh
+++ /dev/null
@@ -1,534 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-# Base commands from hg-git tests:
-# https://bitbucket.org/durin42/hg-git/src
-#
-
-test_description='Test remote-hg output compared to hg-git'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-hg tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
- skip_all='skipping remote-hg tests; mercurial not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import hggit'; then
- skip_all='skipping remote-hg tests; hg-git not available'
- test_done
-fi
-
-# clone to a git repo with git
-git_clone_git () {
- hg -R $1 bookmark -f -r tip master &&
- git clone -q "hg::$PWD/$1" $2
-}
-
-# clone to an hg repo with git
-hg_clone_git () {
- (
- hg init $2 &&
- cd $1 &&
- git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
- ) &&
-
- (cd $2 && hg -q update)
-}
-
-# clone to a git repo with hg
-git_clone_hg () {
- (
- git init -q $2 &&
- cd $1 &&
- hg bookmark -f -r tip master &&
- hg -q push -r master ../$2 || true
- )
-}
-
-# clone to an hg repo with hg
-hg_clone_hg () {
- hg -q clone $1 $2
-}
-
-# push an hg repo with git
-hg_push_git () {
- (
- cd $2
- old=$(git symbolic-ref --short HEAD)
- git checkout -q -b tmp &&
- git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
- git checkout -q $old &&
- git branch -q -D tmp 2> /dev/null || true
- )
-}
-
-# push an hg git repo with hg
-hg_push_hg () {
- (
- cd $1 &&
- hg -q push ../$2 || true
- )
-}
-
-hg_log () {
- hg -R $1 log --graph --debug | grep -v 'tag: *default/'
-}
-
-git_log () {
- git --git-dir=$1/.git fast-export --branches
-}
-
-setup () {
- (
- echo "[ui]"
- echo "username = A U Thor <author@example.com>"
- echo "[defaults]"
- echo "backout = -d \"0 0\""
- echo "commit = -d \"0 0\""
- echo "debugrawcommit = -d \"0 0\""
- echo "tag = -d \"0 0\""
- echo "[extensions]"
- echo "hgext.bookmarks ="
- echo "hggit ="
- ) >> "$HOME"/.hgrc &&
- git config --global receive.denycurrentbranch warn
- git config --global remote-hg.hg-git-compat true
-
- export HGEDITOR=/usr/bin/true
-
- export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230"
- export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
-}
-
-setup
-
-test_expect_success 'executable bit' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- chmod 0644 alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- chmod 0755 alpha &&
- git add alpha &&
- git commit -m "set executable bit" &&
- chmod 0644 alpha &&
- git add alpha &&
- git commit -m "clear executable bit"
- ) &&
-
- for x in hg git; do
- (
- hg_clone_$x gitrepo hgrepo-$x &&
- cd hgrepo-$x &&
- hg_log . &&
- hg manifest -r 1 -v &&
- hg manifest -v
- ) > output-$x &&
-
- git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
- done &&
- cp -r log-* output-* /tmp/foo/ &&
-
- test_cmp output-hg output-git &&
- test_cmp log-hg log-git
-'
-
-test_expect_success 'symlink' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- ln -s alpha beta &&
- git add beta &&
- git commit -m "add beta"
- ) &&
-
- for x in hg git; do
- (
- hg_clone_$x gitrepo hgrepo-$x &&
- cd hgrepo-$x &&
- hg_log . &&
- hg manifest -v
- ) > output-$x &&
-
- git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
- done &&
-
- test_cmp output-hg output-git &&
- test_cmp log-hg log-git
-'
-
-test_expect_success 'merge conflict 1' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- hg init hgrepo1 &&
- cd hgrepo1 &&
- echo A > afile &&
- hg add afile &&
- hg ci -m "origin" &&
-
- echo B > afile &&
- hg ci -m "A->B" &&
-
- hg up -r0 &&
- echo C > afile &&
- hg ci -m "A->C" &&
-
- hg merge -r1 || true &&
- echo C > afile &&
- hg resolve -m afile &&
- hg ci -m "merge to C"
- ) &&
-
- for x in hg git; do
- git_clone_$x hgrepo1 gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'merge conflict 2' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- hg init hgrepo1 &&
- cd hgrepo1 &&
- echo A > afile &&
- hg add afile &&
- hg ci -m "origin" &&
-
- echo B > afile &&
- hg ci -m "A->B" &&
-
- hg up -r0 &&
- echo C > afile &&
- hg ci -m "A->C" &&
-
- hg merge -r1 || true &&
- echo B > afile &&
- hg resolve -m afile &&
- hg ci -m "merge to B"
- ) &&
-
- for x in hg git; do
- git_clone_$x hgrepo1 gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'converged merge' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- hg init hgrepo1 &&
- cd hgrepo1 &&
- echo A > afile &&
- hg add afile &&
- hg ci -m "origin" &&
-
- echo B > afile &&
- hg ci -m "A->B" &&
-
- echo C > afile &&
- hg ci -m "B->C" &&
-
- hg up -r0 &&
- echo C > afile &&
- hg ci -m "A->C" &&
-
- hg merge -r2 || true &&
- hg ci -m "merge"
- ) &&
-
- for x in hg git; do
- git_clone_$x hgrepo1 gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'encoding' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add älphà" &&
-
- export GIT_AUTHOR_NAME="tést èncödîng" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
-
- echo gamma > gamma &&
- git add gamma &&
- git commit -m "add gämmâ" &&
-
- : TODO git config i18n.commitencoding latin-1 &&
- echo delta > delta &&
- git add delta &&
- git commit -m "add déltà"
- ) &&
-
- for x in hg git; do
- hg_clone_$x gitrepo hgrepo-$x &&
- git_clone_$x hgrepo-$x gitrepo2-$x &&
-
- HGENCODING=utf-8 hg_log hgrepo-$x > hg-log-$x &&
- git_log gitrepo2-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'file removal' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta"
- mkdir foo &&
- echo blah > foo/bar &&
- git add foo &&
- git commit -m "add foo" &&
- git rm alpha &&
- git commit -m "remove alpha" &&
- git rm foo/bar &&
- git commit -m "remove foo/bar"
- ) &&
-
- for x in hg git; do
- (
- hg_clone_$x gitrepo hgrepo-$x &&
- cd hgrepo-$x &&
- hg_log . &&
- hg manifest -r 3 &&
- hg manifest
- ) > output-$x &&
-
- git_clone_$x hgrepo-$x gitrepo2-$x &&
- git_log gitrepo2-$x > log-$x
- done &&
-
- test_cmp output-hg output-git &&
- test_cmp log-hg log-git
-'
-
-test_expect_success 'git tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- (
- git init -q gitrepo &&
- cd gitrepo &&
- git config receive.denyCurrentBranch ignore &&
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git tag alpha &&
-
- echo beta > beta &&
- git add beta &&
- git commit -m "add beta" &&
- git tag -a -m "added tag beta" beta
- ) &&
-
- for x in hg git; do
- hg_clone_$x gitrepo hgrepo-$x &&
- hg_log hgrepo-$x > log-$x
- done &&
-
- test_cmp log-hg log-git
-'
-
-test_expect_success 'hg author' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- for x in hg git; do
- (
- git init -q gitrepo-$x &&
- cd gitrepo-$x &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone_$x gitrepo-$x hgrepo-$x &&
- cd hgrepo-$x &&
-
- hg co master &&
- echo beta > beta &&
- hg add beta &&
- hg commit -u "test" -m "add beta" &&
-
- echo gamma >> beta &&
- hg commit -u "test <test@example.com> (comment)" -m "modify beta" &&
-
- echo gamma > gamma &&
- hg add gamma &&
- hg commit -u "<test@example.com>" -m "add gamma" &&
-
- echo delta > delta &&
- hg add delta &&
- hg commit -u "name<test@example.com>" -m "add delta" &&
-
- echo epsilon > epsilon &&
- hg add epsilon &&
- hg commit -u "name <test@example.com" -m "add epsilon" &&
-
- echo zeta > zeta &&
- hg add zeta &&
- hg commit -u " test " -m "add zeta" &&
-
- echo eta > eta &&
- hg add eta &&
- hg commit -u "test < test@example.com >" -m "add eta" &&
-
- echo theta > theta &&
- hg add theta &&
- hg commit -u "test >test@example.com>" -m "add theta" &&
-
- echo iota > iota &&
- hg add iota &&
- hg commit -u "test <test <at> example <dot> com>" -m "add iota"
- ) &&
-
- hg_push_$x hgrepo-$x gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
-
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp git-log-hg git-log-git &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'hg branch' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- for x in hg git; do
- (
- git init -q gitrepo-$x &&
- cd gitrepo-$x &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -q -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone_$x gitrepo-$x hgrepo-$x &&
-
- cd hgrepo-$x &&
- hg -q co master &&
- hg mv alpha beta &&
- hg -q commit -m "rename alpha to beta" &&
- hg branch gamma | grep -v "permanent and global" &&
- hg -q commit -m "started branch gamma"
- ) &&
-
- hg_push_$x hgrepo-$x gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
-
- hg_log hgrepo2-$x > hg-log-$x &&
- git_log gitrepo-$x > git-log-$x
- done &&
-
- test_cmp hg-log-hg hg-log-git &&
- test_cmp git-log-hg git-log-git
-'
-
-test_expect_success 'hg tags' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
-
- for x in hg git; do
- (
- git init -q gitrepo-$x &&
- cd gitrepo-$x &&
-
- echo alpha > alpha &&
- git add alpha &&
- git commit -m "add alpha" &&
- git checkout -q -b not-master
- ) &&
-
- (
- hg_clone_$x gitrepo-$x hgrepo-$x &&
-
- cd hgrepo-$x &&
- hg co master &&
- hg tag alpha
- ) &&
-
- hg_push_$x hgrepo-$x gitrepo-$x &&
- hg_clone_$x gitrepo-$x hgrepo2-$x &&
-
- (
- git --git-dir=gitrepo-$x/.git tag -l &&
- hg_log hgrepo2-$x &&
- cat hgrepo2-$x/.hgtags
- ) > output-$x
- done &&
-
- test_cmp output-hg output-git
-'
-
-test_done
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
deleted file mode 100755
index 5f81dfa..0000000
--- a/contrib/remote-helpers/test-hg.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012 Felipe Contreras
-#
-# Base commands from hg-git tests:
-# https://bitbucket.org/durin42/hg-git/src
-#
-
-test_description='Test remote-hg'
-
-. ./test-lib.sh
-
-if ! test_have_prereq PYTHON; then
- skip_all='skipping remote-hg tests; python not available'
- test_done
-fi
-
-if ! "$PYTHON_PATH" -c 'import mercurial'; then
- skip_all='skipping remote-hg tests; mercurial not available'
- test_done
-fi
-
-check () {
- (cd $1 &&
- git log --format='%s' -1 &&
- git symbolic-ref HEAD) > actual &&
- (echo $2 &&
- echo "refs/heads/$3") > expected &&
- test_cmp expected actual
-}
-
-setup () {
- (
- echo "[ui]"
- echo "username = H G Wells <wells@example.com>"
- ) >> "$HOME"/.hgrc
-}
-
-setup
-
-test_expect_success 'cloning' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- hg init hgrepo &&
- cd hgrepo &&
- echo zero > content &&
- hg add content &&
- hg commit -m zero
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo zero master
-'
-
-test_expect_success 'cloning with branches' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg branch next &&
- echo next > content &&
- hg commit -m next
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo next next &&
-
- (cd hgrepo && hg checkout default) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo2 &&
- check gitrepo2 zero master
-'
-
-test_expect_success 'cloning with bookmarks' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg bookmark feature-a &&
- echo feature-a > content &&
- hg commit -m feature-a
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo feature-a feature-a
-'
-
-test_expect_success 'cloning with detached head' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg update -r 0
- ) &&
-
- git clone "hg::$PWD/hgrepo" gitrepo &&
- check gitrepo zero master
-'
-
-test_expect_success 'update bookmark' '
- test_when_finished "rm -rf gitrepo*" &&
-
- (
- cd hgrepo &&
- hg bookmark devel
- ) &&
-
- (
- git clone "hg::$PWD/hgrepo" gitrepo &&
- cd gitrepo &&
- git checkout devel &&
- echo devel > content &&
- git commit -a -m devel &&
- git push
- ) &&
-
- hg -R hgrepo bookmarks | grep "devel\s\+3:"
-'
-
-test_done
diff --git a/t/Makefile b/t/Makefile
index 1923cc1..612fe79 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -48,7 +48,7 @@ clean: clean-except-prove-cache
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
test-lint-duplicates:
- @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
+ @dups=`echo $(T) $(TDUP) | tr ' ' '\n' | sed -ne 's|\(.*/\)*t\([0-9][0-9][0-9][0-9]\)-.*|\2|p' | sort | uniq -d` && \
test -z "$$dups" || { \
echo >&2 "duplicate test numbers:" $$dups; exit 1; }
--
1.8.1.1
^ permalink raw reply related
* Re: [PATCH] send-email: Honor multi-part email messages
From: Jeff King @ 2013-01-25 22:24 UTC (permalink / raw)
To: Krzysztof Mazur; +Cc: Alexey Shumkin, git, Junio C Hamano
In-Reply-To: <20130125174700.GA3700@shrek.podlesie.net>
On Fri, Jan 25, 2013 at 06:47:00PM +0100, Krzysztof Mazur wrote:
> On Fri, Jan 25, 2013 at 07:28:54PM +0400, Alexey Shumkin wrote:
> > "git format-patch --attach/--inline" generates multi-part messages.
> > Every part of such messages can contain non-ASCII characters with its own
> > "Content-Type" and "Content-Transfer-Encoding" headers.
> > But git-send-mail script interprets a patch-file as one-part message
> > and does not recognize multi-part messages.
> > So already quoted printable email subject may be encoded as quoted printable
> > again. Due to this bug email subject looks corrupted in email clients.
>
> I don't think that the problem with the Subject is multi-part message
> specific. The real problem with the Subject is probably that
> is_rfc2047_quoted() does not detect that the Subject is already quoted.
I have not even looked at this problem at all, but seeing this function
name:
> > sub body_or_subject_has_nonascii {
Makes me think something is very wrong. The subject line should not have
anything to do whatsoever with a content-type or
content-transfer-encoding header. It should either be rfc2047 encoded or
not, and the encoding used does not have to correspond to what is used
elsewhere in the message. rfc2047 is very clear that other MIME headers
are not necessary to interpret encoded words in headers.
So this loop:
foreach my $f (@files) {
next unless (body_or_subject_has_nonascii($f)
&& !file_declares_8bit_cte($f));
$broken_encoding{$f} = 1;
}
does not seem right at all. Only the body depends on the 8bit CTE.
-Peff
^ permalink raw reply
* Re: [regression] Re: [PATCHv2 10/15] drop length limitations on gecos-derived names and emails
From: Jeff King @ 2013-01-25 22:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jonathan Nieder, Angus Hammond, git, Mihai Rusu
In-Reply-To: <7vtxq53xt3.fsf@alter.siamese.dyndns.org>
On Fri, Jan 25, 2013 at 10:46:48AM -0800, Junio C Hamano wrote:
> Will queue this one, to be merged to 'maint' and 'master'.
>
> -- >8 --
> From: Jonathan Nieder <jrnieder@gmail.com>
> Date: Thu, 24 Jan 2013 15:21:46 -0800
> Subject: [PATCH] ident: do not drop username when reading from /etc/mailname
Thanks, looks fine to me (and thanks to Jonathan). One nit:
> - if (strbuf_getline(buf, mailname, '\n') == EOF) {
> + if (strbuf_getline(&mailnamebuf, mailname, '\n') == EOF) {
> if (ferror(mailname))
> warning("cannot read /etc/mailname: %s",
> strerror(errno));
> + strbuf_release(&mailnamebuf);
> fclose(mailname);
> return -1;
> }
This strbuf_release is unnecessary, as an EOF return by definition means
we did not read anything. I don't mind it as a defensive measure,
though, in case the strbuf implementation changes to pre-allocate.
-Peff
^ permalink raw reply
* Re: [PATCH] t9902: protect test from stray build artifacts
From: Jeff King @ 2013-01-25 22:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jean-Noël AVILA, git
In-Reply-To: <7v1ud95cxb.fsf@alter.siamese.dyndns.org>
On Fri, Jan 25, 2013 at 10:34:56AM -0800, Junio C Hamano wrote:
> >> Not so quick, though. The lower level "read from help -a" is only
> >> run once and its output kept in a two-level cache hierarchy; we need
> >> to reset both.
> >
> > Ugh, I didn't even think about that.
> >
> > I wonder if it would be simpler if the completion tests actually ran a
> > new bash for each test. That would be slower, but it somehow seems
> > cleaner.
>
> I agree 100% with that. Let's leave this fix as-is, at least as a
> tentative fix while "git check-ignore" graduates into the upcoming
> release, and let somebody who is interested work on an update to
> this test script to do so as an independent topic.
Sounds good to me. Thanks.
-Peff
^ permalink raw reply
* Re: [PATCH] git-web--browser: avoid errors in terminal when running Firefox on Windows
From: Jeff King @ 2013-01-25 22:06 UTC (permalink / raw)
To: Alexey Shumkin; +Cc: git, Junio C Hamano
In-Reply-To: <3eeabf4989f7f1b4593e89e4c6bcfa8710a7b793.1359125053.git.Alex.Crezoff@gmail.com>
On Fri, Jan 25, 2013 at 06:44:13PM +0400, Alexey Shumkin wrote:
> test_web_browse () {
> - # browser=$1 url=$2
> + # browser=$1 url=$2 sleep_timeout=$3
> + sleep_timeout="$3"
> git web--browse --browser="$1" "$2" >actual &&
> + # if $3 is set
> + # as far as Firefox is run in background (it is run with &)
> + # we trying to avoid race condition
> + # by waiting for "$sleep_timeout" seconds of timeout for 'fake_browser_ran' file appearance
> + (test -z "$sleep_timeout" || (
> + for timeout in $(seq 1 $sleep_timeout); do
> + test -f fake_browser_ran && break
> + sleep 1
> + done
> + test $timeout -ne $sleep_timeout
> + )
> + ) &&
> tr -d '\015' <actual >text &&
Gross, but I don't really see another way to handle the asynchronous
nature of spawning background browsers.
Two things, though:
1. Should test_web_browse just delete fake_browser_ran for us? Then
later tests do not have to remember to do so.
2. Seeing fake_browser_ran appeared, we know that the script has
started. But there is still a race condition in which it may not
have written anything to "actual" yet.
In this implementation:
> + cat >"fake browser" <<-\EOF &&
> + #!/bin/sh
> +
> + : > fake_browser_ran
> + if test "$1" = "-version"; then
> + echo Fake Firefox browser version 1.2.3
> + else
> + # Firefox (in contrast to w3m) is run in background (with &)
> + # so redirect output to "actual"
> + echo fake: "$@" > actual
> + fi
> + EOF
There is a period where fake_browser_ran exists, but nothing is in
actual. You can solve it by setting fake_browser_ran at the end rather
than the beginning.
Or you can drop fake_browser_ran entirely, and just atomically move
actual into place, like:
echo "fake: $*" >actual.tmp
mv actual.tmp actual
and then test_web_browse can just spin waiting for "actual" to appear.
-Peff
^ permalink raw reply
* [PATCH 9/7] mergetool--lib: fix path lookup in guess_merge_tool
From: John Keeping @ 2013-01-25 22:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Aguilar, git
In-Reply-To: <20130125220222.GE7498@serenity.lan>
guess_merge_tool calls translate_merge_tool_path in order to get the
correct name of the tool to check whether it can be found on the user's
system. But this function is designed to be overridden by tool
scriptlets so it does nothing if the relevant scriptlet has not been
sourced.
Fix this by calling setup_tool before doing anything.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
git-mergetool--lib.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index c6bd8ba..46860c5 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -219,6 +219,7 @@ guess_merge_tool () {
# Loop over each candidate and stop when a valid merge tool is found.
for i in $tools
do
+ setup_tool "$i" 2>&1 || continue
merge_tool_path="$(translate_merge_tool_path "$i")"
if type "$merge_tool_path" >/dev/null 2>&1
then
--
1.8.1
^ permalink raw reply related
* [PATCH 8/7] mergetool--lib: don't call "exit" in setup_tool
From: John Keeping @ 2013-01-25 22:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Aguilar, git
In-Reply-To: <20130125220222.GE7498@serenity.lan>
This will make it easier to use setup_tool in places where we expect
that the selected tool will not support the current mode.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
git-mergetool--lib.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 4c1e129..c6bd8ba 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -67,11 +67,11 @@ setup_tool () {
if merge_mode && ! can_merge
then
echo "error: '$tool' can not be used to resolve merges" >&2
- exit 1
+ return 1
elif diff_mode && ! can_diff
then
echo "error: '$tool' can only be used to resolve merges" >&2
- exit 1
+ return 1
fi
return 0
}
@@ -100,7 +100,7 @@ run_merge_tool () {
status=0
# Bring tool-specific functions into scope
- setup_tool "$1"
+ setup_tool "$1" || return
if merge_mode
then
--
1.8.1
^ permalink raw reply related
* Re: [PATCH 7/7] mergetool--lib: Improve show_tool_help() output
From: John Keeping @ 2013-01-25 22:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Aguilar, git
In-Reply-To: <7vbocd2auo.fsf@alter.siamese.dyndns.org>
On Fri, Jan 25, 2013 at 01:47:59PM -0800, Junio C Hamano wrote:
> John Keeping <john@keeping.me.uk> writes:
> > With the patch above, the block of code at the top becomes:
> >
> > test "$tool" = defaults && continue
> >
> > setup_tool "$tool" 2>/dev/null || continue
> > merge_tool_path=$(translate_merge_tool_path "$tool")
> >
> > which IMHO is pretty readable.
>
> Of course it is. The current callers of setup_tool may need some
> adjustments, but that should be fairly trivial, I hope.
There are only two and one of them already seems like it doesn't want
the command to cause the script to exit.
David, can you incorporate the following two patches when you re-roll?
Your original 7/7 with the change above will want to build on 8/7.
John
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox