Compare commits

..

9 Commits

Author SHA1 Message Date
edca415256 Git 1.8.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-24 11:34:46 -07:00
5e49f30c85 remote-hg: fix order of configuration comments
The other configurations were added in the wrong place.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-21 09:33:24 -07:00
92c4369907 remote-hg: trivial configuration note cleanup
Follow the style of the previous configurations.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-21 09:33:21 -07:00
737044517f completion: regression fix for zsh
zsh completion wrapper doesn't reimplement __gitcompadd(). Although it
should be trivial to do that, let's use __gitcomp_nl() which achieves
exactly the same thing, specially since the suffix ($4) has to be empty.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-21 09:28:45 -07:00
9134a460e3 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git-svn: introduce --parents parameter for commands branch and tag
  git-svn: clarify explanation of --destination argument
  git-svn: multiple fetch/branches/tags keys are supported
2013-05-20 16:06:48 -07:00
f4f4c7fc00 git-svn: introduce --parents parameter for commands branch and tag
This parameter is equivalent to the parameter --parents on svn cp commands
and is useful for non-standard repository layouts.

Signed-off-by: Tobias Schulte <tobias.schulte@gliderpilot.de>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-05-20 22:05:54 +00:00
7d82b4af1c git-svn: clarify explanation of --destination argument
The existing documentation for "-d" does not make it obvious whether
its argument is supposed to be a full svn path, a partial svn path,
the glob from the config file, or what.  Clarify the text and add an
example to get the reader started.

Reported-by: Nathan Gray <n8gray@n8gray.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-05-20 22:05:47 +00:00
eff714bdda git-svn: multiple fetch/branches/tags keys are supported
"git svn" can be configured to use multiple fetch, branches, and tags
refspecs by passing multiple --branches or --tags options at init time
or editing the configuration file later, which can be handy when
working with messy Subversion repositories.  Add a note to the
configuration section documenting how this works.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2013-05-20 22:05:47 +00:00
5dbe064d8c remote-hg: set stdout to binary mode on win32
git clone hangs on windows, and file.write would return errno 22 inside
of mercurial's windows.winstdout wrapper class. This patch sets stdout's
mode to binary, fixing both issues.

[fc: cleaned up]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-20 11:18:43 -07:00
6 changed files with 117 additions and 22 deletions

View File

@ -42,8 +42,11 @@ Updates since v1.8.2
Foreign interface
* remote-hg and remote-bzr helpers (in contrib/ since v1.8.2) have
been updated; especially, the latter has been accelerated to help
Emacs folks, whose primary SCM seems to be stagnating.
been updated; especially, the latter has been done in an
accelerated schedule (read: we may not have merged to this release
if we were following the usual "cook sufficiently in next before
unleashing it to the world" workflow) in order to help Emacs folks,
whose primary SCM seems to be stagnating.
UI, Workflows & Features
@ -111,9 +114,10 @@ UI, Workflows & Features
of erroneous inputs was suboptimal and has been improved.
* When the interactive access to git-shell is not enabled, it issues
a message meant to help the system administrator to enable it.
An explicit way to help the end users who connect to the service by
issuing custom messages to refuse such an access has been added.
a message meant to help the system administrator to enable it. An
explicit way has been added to issue custom messages to refuse an
access over the network to help the end users who connect to the
service expecting an interactive shell.
* In addition to the case where the user edits the log message with
the "e)dit" option of "am -i", replace the "Applying: this patch"
@ -123,8 +127,8 @@ UI, Workflows & Features
* "git status" suggests users to look into using --untracked=no option
when it takes too long.
* "git status" shows a bit more information during a
rebase/bisect session.
* "git status" shows a bit more information during a rebase/bisect
session.
* "git fetch" learned to fetch a commit at the tip of an unadvertised
ref by specifying a raw object name from the command line when the
@ -241,7 +245,6 @@ details).
* Various subcommands of "git remote" simply ignored extraneous
command line arguments instead of diagnosing them as errors.
(merge b17dd3f tr/remote-tighten-commandline-parsing later to maint).
* When receive-pack detects an error in the pack header it received in
order to decide which of unpack-objects or index-pack to run, it
@ -264,7 +267,6 @@ details).
buffer around as human readable object names. This was not a huge
problem but was exposed by a new change that uses these names in
error output.
(merge 70d26c6 tr/copy-revisions-from-stdin later to maint).
* Smart-capable HTTP servers were not restricted via the
GIT_NAMESPACE mechanism when talking with commit-walking clients,
@ -309,11 +311,9 @@ details).
* Fix a 1.8.1.x regression that stopped matching "dir" (without a
trailing slash) to a directory "dir".
(merge efa5f82 jc/directory-attrs-regression-fix later to maint-1.8.1).
* "git apply --whitespace=fix" was not prepared to see a line getting
longer after fixing whitespaces (e.g. tab-in-indent aka Python).
(merge 329b26e jc/apply-ws-fix-tab-in-indent later to maint-1.8.1).
* The prompt string generator (in contrib/completion/) did not notice
when we are in a middle of a "git revert" session.

View File

@ -271,13 +271,15 @@ first have already been pushed into SVN.
Create a tag by using the tags_subdir instead of the branches_subdir
specified during git svn init.
-d;;
--destination;;
-d<path>;;
--destination=<path>;;
If more than one --branches (or --tags) option was given to the 'init'
or 'clone' command, you must provide the location of the branch (or
tag) you wish to create in the SVN repository. The value of this
option must match one of the paths specified by a --branches (or
--tags) option. You can see these paths with the commands
tag) you wish to create in the SVN repository. <path> specifies which
path to use to create the branch or tag and should match the pattern
on the left-hand side of one of the configured branches or tags
refspecs. You can see these refspecs with the commands
+
git config --get-all svn-remote.<name>.branches
git config --get-all svn-remote.<name>.tags
@ -298,6 +300,11 @@ where <name> is the name of the SVN repository as specified by the -R option to
git config --get-all svn-remote.<name>.commiturl
+
--parents;;
Create parent folders. This parameter is equivalent to the parameter
--parents on svn cp commands and is useful for non-standard repository
layouts.
'tag'::
Create a tag in the SVN repository. This is a shorthand for
'branch -t'.
@ -1032,6 +1039,25 @@ comma-separated list of names within braces. For example:
tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
------------------------------------------------------------------------
Multiple fetch, branches, and tags keys are supported:
------------------------------------------------------------------------
[svn-remote "messy-repo"]
url = http://server.org/svn
fetch = trunk/project-a:refs/remotes/project-a/trunk
fetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo
branches = branches/server/*:refs/remotes/project-a/branches/*
branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*
tags = tags/server/*:refs/remotes/project-a/tags/*
------------------------------------------------------------------------
Creating a branch in such a configuration requires disambiguating which
location to use using the -d or --destination flag:
------------------------------------------------------------------------
$ git svn branch -d branches/server release-2-3-0
------------------------------------------------------------------------
Note that git-svn keeps track of the highest revision in which a branch
or tag has appeared. If the subset of branches or tags is changed after
fetching, then .git/svn/.metadata must be manually edited to remove (or

View File

@ -1831,7 +1831,7 @@ _git_config ()
local remote="${prev#remote.}"
remote="${remote%.fetch}"
if [ -z "$cur" ]; then
__gitcompadd "refs/heads/" "" "" ""
__gitcomp_nl "refs/heads/" "" "" ""
return
fi
__gitcomp_nl "$(__git_refs_remotes "$remote")"

View File

@ -24,9 +24,6 @@ import urllib
import atexit
import urlparse, hashlib
#
# If you want to switch to hg-git compatibility mode:
# git config --global remote-hg.hg-git-compat true
#
# If you are not in hg-git-compat mode and want to disable the tracking of
# named branches:
@ -36,7 +33,10 @@ import urlparse, hashlib
# git config --global remote-hg.force-push false
#
# If you want the equivalent of hg's clone/pull--insecure option:
# git config remote-hg.insecure true
# git config --global remote-hg.insecure true
#
# If you want to switch to hg-git compatibility mode:
# git config --global remote-hg.hg-git-compat true
#
# git:
# Sensible defaults for git.
@ -954,6 +954,10 @@ def main(args):
marks_path = os.path.join(dirname, 'marks-hg')
marks = Marks(marks_path)
if sys.platform == 'win32':
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
parser = Parser(repo)
for line in parser:
if parser.check('capabilities'):

View File

@ -113,7 +113,7 @@ my ($_stdin, $_help, $_edit,
$_template, $_shared,
$_version, $_fetch_all, $_no_rebase, $_fetch_parent,
$_before, $_after,
$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
$_merge, $_strategy, $_preserve_merges, $_dry_run, $_parents, $_local,
$_prefix, $_no_checkout, $_url, $_verbose,
$_commit_url, $_tag, $_merge_info, $_interactive);
@ -203,6 +203,7 @@ my %cmd = (
{ 'message|m=s' => \$_message,
'destination|d=s' => \$_branch_dest,
'dry-run|n' => \$_dry_run,
'parents' => \$_parents,
'tag|t' => \$_tag,
'username=s' => \$Git::SVN::Prompt::_username,
'commit-url=s' => \$_commit_url } ],
@ -211,6 +212,7 @@ my %cmd = (
{ 'message|m=s' => \$_message,
'destination|d=s' => \$_branch_dest,
'dry-run|n' => \$_dry_run,
'parents' => \$_parents,
'username=s' => \$Git::SVN::Prompt::_username,
'commit-url=s' => \$_commit_url } ],
'set-tree' => [ \&cmd_set_tree,
@ -1172,6 +1174,10 @@ sub cmd_branch {
$ctx->ls($dst, 'HEAD', 0);
} and die "branch ${branch_name} already exists\n";
if ($_parents) {
mk_parent_dirs($ctx, $dst);
}
print "Copying ${src} at r${rev} to ${dst}...\n";
$ctx->copy($src, $rev, $dst)
unless $_dry_run;
@ -1179,6 +1185,17 @@ sub cmd_branch {
$gs->fetch_all;
}
sub mk_parent_dirs {
my ($ctx, $parent) = @_;
$parent =~ s{/[^/]*$}{};
if (!eval{$ctx->ls($parent, 'HEAD', 0)}) {
mk_parent_dirs($ctx, $parent);
print "Creating parent folder ${parent} ...\n";
$ctx->mkdir($parent) unless $_dry_run;
}
}
sub cmd_find_rev {
my $revision_or_hash = shift or die "SVN or git revision required ",
"as a command-line argument\n";

View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# Copyright (c) 2013 Tobias Schulte
#
test_description='git svn branch for subproject clones'
. ./lib-git-svn.sh
test_expect_success 'initialize svnrepo' '
mkdir import &&
(
cd import &&
mkdir -p trunk/project branches tags &&
(
cd trunk/project &&
echo foo > foo
) &&
svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
) &&
rm -rf import &&
svn_cmd co "$svnrepo"/trunk/project trunk/project &&
(
cd trunk/project &&
echo bar >> foo &&
svn_cmd ci -m "updated trunk"
) &&
rm -rf trunk
'
test_expect_success 'import into git' '
git svn init --trunk=trunk/project --branches=branches/*/project \
--tags=tags/*/project "$svnrepo" &&
git svn fetch &&
git checkout remotes/trunk
'
test_expect_success 'git svn branch tests' '
test_must_fail git svn branch a &&
git svn branch --parents a &&
test_must_fail git svn branch -t tag1 &&
git svn branch --parents -t tag1 &&
test_must_fail git svn branch --tag tag2 &&
git svn branch --parents --tag tag2 &&
test_must_fail git svn tag tag3 &&
git svn tag --parents tag3
'
test_done