aboutsummaryrefslogtreecommitdiff
path: root/git-svn.perl
Commit message (Collapse)AuthorAge
* git-svn: Added 'find-rev' commandAdam Roben2007-04-27
| | | | | | | | | This patch adds a new 'find-rev' command to git-svn that lets you easily translate between SVN revision numbers and git tree-ish. Signed-off-by: Adam Roben <aroben@apple.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: Ignore usernames in URLs in find_by_urlAdam Roben2007-04-25
| | | | | | | | | Usernames don't matter for the purposes of find_by_url, so always remove them before doing any comparisons. Signed-off-by: Adam Roben <aroben@apple.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: Don't rely on $_ after making a function callAdam Roben2007-04-25
| | | | | | | | | | Many functions and operators in perl set $_, so its value cannot be relied upon after calling arbitrary functions. The solution is simply to copy the value of $_ into a local variable that will not get overwritten. Signed-off-by: Adam Roben <aroben@apple.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Remove usernames from all commit messages, not just when using svmpropsAdam Roben2007-04-24
| | | | | | | Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz> Signed-off-by: Adam Roben <aroben@apple.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: don't allow globs to match regular filesEric Wong2007-04-18
| | | | | | | | | | | | | | git only tracks the histories of full directories, not that of individual files. Sometimes, SVN users will place[1] a regular file in the directory designated for subdirectories of branches or tags. Thanks to jrockway on #git for pointing this out. [1] mistakenly or otherwise, such as a README Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: quiet some warnings when run only with --version/--helpEric Wong2007-04-17
| | | | | | | | These are harmless but annoying. They were introduced in 512b620bd9fef7f170562ecad835e37479f051ce Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: respect lower bound of -r/--revision when following parentEric Wong2007-04-17
| | | | | | | | When an explicit --revision argument is specified, do not fetch past the specified range into the beginning of history. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: fix log command to avoid infinite loop on long commit messagesEric Wong2007-04-08
| | | | | | | | | | This bug has been around since the the conversion to use the Git.pm library back in October or November. Eventually I'd like "git rev-list/log" to have the option to not truncate overly long messages. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: dcommit/rebase confused by patches with git-svn-id: linesEric Wong2007-04-08
| | | | | | | | | | | | | | When patches are merged from another git-svn managed branch, they will have the git-svn-id: metadata line in them (generated by git-format-patch). When doing rebase or dcommit via git-svn, this would cause git-svn to find the wrong upstream branch. We now verify that the commit is consistent with the value in the .rev_db file. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: bail out on incorrect command-line optionsEric Wong2007-04-08
| | | | | | | | | | | | | "git svn log" is the only command that needs the pass-through option in Getopt::Long; otherwise we will bail out and let the user know something is wrong. Also, avoid printing out unaccepted mixed-case options (that are reserved for the command-line) such as --useSvmProps in the usage() function. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: fail on rebase if we are unable to find a ref to rebase againstEric Wong2007-03-31
| | | | | | | | If we're on an invalid HEAD, we should detect this and avoid attempting to continue. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: avoid respewing similar error messages for missing pathsEric Wong2007-03-31
| | | | | | | | | | | | | | We ignore errors if the path we're tracking did not exist for a particular revision range, but we still print out warnings telling the user about that. As pointed out by Seth Falcon, this amounts to a lot of warnings that could confuse and worry users. I'm not entirely comfortable completely silencing the warnings, but showing one warning per path that we track should be reasonable. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: fix rel_path() when not connected to the repository rootEric Wong2007-03-25
| | | | | | | | | | | | | | | This should fix fetching for people who did not use "git svn --minimize" or cannot connect to the repository root due to the lack of permissions. I'm not sure what I was on when I made the change to the rel_path() function in 4e9f6cc78e5d955bd0faffe76ae9aea6590189f1 that made it die() when we weren't connected to the repository root :x Thanks to Sven Verdoolaege for reporting this bug. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: add -l/--local command to "git svn rebase"Eric Wong2007-03-13
| | | | | | | | | This avoids fetching new revisions remotely, and is usefuly versus plain "git rebase" because the user does not have to specify which remote head to rebase against. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: fix show-ignore when not connected to the repository rootEric Wong2007-03-04
| | | | | | | It was traversing the entire repository before. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-svn: fix some potential bugs with --follow-parentEric Wong2007-02-23
| | | | | | | | | | | | | | | | | When using do_switch: We only need to ensure the index is clean and set to that of the parent tree) we rely on being able to reconstruct full files with deltas transferred over the network. When using do_update: We may safely unlink the index if we are fetching an entire new tree with do_update. Having an old index (from a previously deleted/abandoned directory) around can cause irrelevant files to be mistakenly kept. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: fix reconnections to different paths of svn:// repositoriesEric Wong2007-02-23
| | | | | | | | | | | | Clearing the pool of the previous SVN::Ra connection we have seems to to fix mysterious connection dropping errors when reconnecting to different paths of svn:// repositories hosted by rubyforge.org. Note: I'm not sure *why* this fixes things things, but it does for me. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: fix clone when a target directory has been specifiedEric Wong2007-02-23
| | | | | | | | | | | | | Several bugs caused this to fail: * GIT_DIR was set incorrectly after entering the target directory * Avoid double chdir-ing when clone is called with an explicit path * create target subdirectory *before* running git-init when using the multi-init path Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: don't consider SVN URL usernames significant when comparingSam Vilain2007-02-23
| | | | | | | | http://foo@blah.com/path is the same as http://blah.com/path, so remove usernames from URLs before storing them in commits, and when reading them from commits. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: ensure we're at the top-level and can access $GIT_DIREric Wong2007-02-23
| | | | | | | | | | | If we are run inside a subdirectory of a working tree, we'll chdir to the top first before touching anything. This also prevents the accidental creation of .git directories inside subdirectories since they need metadata. Noticed by maio on #git Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: give show-ignore HEAD smarts, like dcommit and logEric Wong2007-02-23
| | | | | | | | | This allows the user to run git-svn show-ignore on there current HEAD without needing to remember which branch/ref they branched from with -i. Also, find_by_url should correctly handle cases where the URL passed to it is not valid. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: allow metadata options to be specified with 'init' and 'clone'Eric Wong2007-02-23
| | | | | | | | | | | | | Since the options that affect the way metadata is handled in git-svn, should be consistently set/unset throughout history imported by git-svn; it makes sense to allow the user to set certain options from the command-line that will write to the config file when initially creating the repository. Also, fix some formatting issues while we're updating documentation. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: fix useSvmProps, hopefully for the last timeEric Wong2007-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | svm:mirror is not useful at all for us. Parts of the old unit test were broken and based on my misunderstanding of the svm:mirror property. When we read svm:source; make sure we correctly handle the '!' in it: it is used to separate the path of the repository root from the virtual path within the repository. We don't need to make that distinction, honestly! We also ensure that subdirectories are also mirrored with the correct URL if we're using useSvmProps. We have a new test that uses dumped repo that was really created using SVN::Mirror to avoid ambiguities and mis-understandings about the svm: properties. Note: trailing whitespace in the svm.dump file is unfortunately a reality and required by SVN; so please ignore it when applying this patch. Also, ensure that the -R/--remote/--svn-remote flag is always in effect if explicitly passed via the command-line. This allows us to track logically different mirrors sharing the same URL (probably common with SVN::Mirror/SVK users). Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: add support for using svnsync propertiesEric Wong2007-02-23
| | | | | | | | | | | | This is similar to useSvmProps, but far simpler in implementation because svnsync retains a 1:1 between revision numbers and relative paths within the repository Config keys: svn.useSvnsyncProps svn-remote.<repo>.useSvnsyncProps Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: allow overriding of the SVN repo root in metadataEric Wong2007-02-23
| | | | | | | | | | | | This feature allows users to create repositories from alternate URLs. For example, an administrator could run git-svn on the server locally (accessing via file://) but wish to distribute the repository with a public http:// or svn:// URL in the metadata so users of it will see the public URL. Config key: svn-remote.<remote>.rewriteRoot Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: add 'clone' command, an alias for init + fetchEric Wong2007-02-23
| | | | Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: hide the private git-svn 'config' file as '.metadata'Eric Wong2007-02-23
| | | | | | | | | | | Having it named as 'config' prevents us from tracking a ref named 'config', which is a huge mistake. On the non-technical side, the word 'config' implies that a user can freely modify it; but that's not the case here. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: fix some issues for people migrating from older versionsEric Wong2007-02-23
| | | | | | | | | | * Fixed logic for renaming old .rev_db -> .rev_db.$uuid * correctly handle manual migrations for those who decide to start use globbing to handle branches/tags over individual 'fetch' keys Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: add a 'rebase' commandEric Wong2007-02-23
| | | | | | | | | | | | | | | | This works similarly to 'svn update' or 'git pull' except that it preserves linear history with 'git rebase' instead of 'git merge' for ease of dcommit-ing with git-svn. While we're at it, put the working_head_info() logic into its own function and allow --fetch-all/--all for dcommit and rebase (which will fetch all refs in the current [svn-remote] instead of just the working one). Note that the '-a' switch (short for --fetch-all/--all) has been removed as it conflicts with the non-svn 'git fetch' Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: checkout files on new fetchesEric Wong2007-02-23
| | | | | | | | | | | | | On newly-created repositories, 'refs/heads/master' does not point to anything. This can be confusing to new users; so we update 'master' to point to the last imported ref after fetching is done. Once 'master' is valid; we assume HEAD points to it; and if the repository is not bare, then checkout the files if the working tree is clean and unused. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: add support for --stat in the log commandEric Wong2007-02-23
| | | | Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: documentation updates for new functionalityEric Wong2007-02-23
| | | | | | | | | | Force the showing of the --minimize flag as an option in the 'migrate' help. Also, fix the usage function to correctly filter out the deprecated aliases. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: allow dcommit for those who only fetch from SVM with useSvmPropsEric Wong2007-02-23
| | | | | | | | | | | This allows users to use SVM (SVN::Mirror) to mirror a remote repository to use dcommit to commit to the repository that SVM was mirroring. When dcommit is used in this manner, the automatic fetch + rebase/reset does not happen; in which case the user will have to manually invoke svm/svk, run 'git svn fetch', and finally 'git rebase'. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: error checking for invalid [svn-remote "..."] sectionsEric Wong2007-02-23
| | | | | | | We don't end up trying to pass an undef URL over to SVN::Ra->new because it'll segfault. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: remember to check for clean indices on globbed refs, tooEric Wong2007-02-23
| | | | | | | Also, warn about dirty indices and avoid an unncessary write-tree call if the index is clean. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: allow --log-window-size to be specified, default to 100Eric Wong2007-02-23
| | | | | | | | | | The newer default value should should lower memory usage for large fetches and also help with fetching from less reliable servers. Previously the value was 1000 and memory usage got a bit high on some repositories and fetching became less reliable in some cases. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: simplify the (multi-)init methods of fetchingEric Wong2007-02-23
| | | | | | | | Also, some changes to avoid creating dead dirs under .git/svn/. We now create all directories as late as possible. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: brown paper bag fixesEric Wong2007-02-23
| | | | | | | | * avoid skipping modification-only changes in fetch * correctly fetch when we only have branches and tags to glob from (no fetch keys defined) Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: allow 'init' to act as multi-initEric Wong2007-02-23
| | | | | | | | | | | | | multi-init is now just an alias that requires -T/-t/-b; all options that 'init' can now accept. This will hopefully simplify usage and reduce typing. Also, allow the --shared option in 'init' to take an optional argument now that 'git-init --shared' supports an optional argument. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: hopefully make 'fetch' more user-friendlyEric Wong2007-02-23
| | | | | | | | | | | | | | | multi-fetch is deprecated, "fetch -a" is easier to type By default, fetch will fetch everything from its default [svn-remote]; if fetch [--all|-a] is specified, then it will fetch from all svn remotes. Refspecs on the command-line (like git-fetch) are not supported. Also, enable -r/--revision arguments for fetch so users can shoot themselves in the foot^W^W^W^W^W skip some history and do the equivalent of a shallow clone/fetch they're not interested in. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: usability fixes for the 'git svn log' commandEric Wong2007-02-23
| | | | | | | | | | | Similar in spirit to the recent dcommit change, we now look at 'HEAD' by default to look for a GIT_SVN_ID so the user won't have to pass -i <GIT_SVN_ID> argument. We are also more tolerant of of people passing bare remote names as a result (just $GIT_SVN_ID without the -i) Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: include merges when calling rev-list for decommitEric Wong2007-02-23
| | | | | | | | Merge commits can be created when following certain parents, (most notably 'R' cases) and we definitely don't want to exclude them. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: make dcommit usable for glob usersEric Wong2007-02-23
| | | | | | | | | | | | | | | | | | | | * dcommit no longer requires the correct -i/GIT_SVN_ID option passed to it. Since you're committing from HEAD (or another commit that is a parent of HEAD), you'll be able to find a commit with metadata information containing the SVN URL that your HEAD was descended from anyways. * I don't think dcommit ever worked for people using the noMetadata option; so I don't think relying on metadata is an issue. * useSvmProps users shouldn't commit to SVN::Mirror created repositories anyways, right? * Users of globbing should automatically be able to commit to paths that are not explicitly set in .git/config Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: handle multi-init without --trunk, UseSvmProps fixesEric Wong2007-02-23
| | | | | | | | | | | | | | | | multi-init did not write a svn-remote.<remote>.url config entry without a --trunk argument. Also, The svm:mirror property is used by SVN::Mirror to track the path of the repository that we are mirroring. We need to append that to the source (which is (presumably) just the URL of the repository root). Lastly, we now look harder for svm:(source|mirror|uuid) properties in sub and parent directories. Since our relative path could be tweaked. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: write the highest maxRex out for branches and tagsEric Wong2007-02-23
| | | | | | | | | Even if nothing touched paths we care about in a fetch; increment the maxRev like we do with rev_db since we don't like having to run get_log on revisions we've seen before. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: use separate, per-repository .rev_db filesEric Wong2007-02-23
| | | | | | | | | | | | | | We need a separate .rev_db file for each repository we're tracking. This allows us to track the same logical path off multiple mirrors. We preserve a symlink to the old .rev_db (no-UUID) if we're (auto-)migrating from an old version to preserve backwards compatibility. Also, get rid of the uuid() wrapper since we cache UUID in our private config, and the SVN::Ra::get_uuid() function memoizes the return value per-connection. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: extra safety for noMetadata and useSvmProps usersEric Wong2007-02-23
| | | | | | | | | | | | | Make sure we flush our userspace buffers and and fsync(2) .rev_db information to disk if we use these options because we really don't want to lose this information. Also, disallow --use-svm-props and --no-metadata from the command-line because history will be inconsistent if they're only used occasionally. If a user wants to use these options, they must be set in the config so they're always on. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: use private $GIT_DIR/svn/config file moreEric Wong2007-02-23
| | | | | | | Switch max_rev storage over to using it for globbing branches and tags. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: add support for per-[svn-remote "..."] optionsEric Wong2007-02-23
| | | | | | | | | | | | | | | Available options are currently: svn-remote.<remote>.{noMetadata,useSvmProps,followParent} These boolean switches will override options set globally in [svn], and even override options set on the command-line (this should probably change in the future, however). Note that the noMetadata and useSvmProps options conflict. It's both technically and logically impossible to use them together. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* git-svn: add support for SVN::Mirror/svk using revprops for metadataEric Wong2007-02-23
| | | | | | | | | | | | | | | | | | | | Pass --use-svm-props or set the svn.usesvmprops key with git-config to enable using properties set by SVN::Mirror when it mirrored the upstream URL. This is heavily based on work from Sam Vilain: > From: Sam Vilain <sam@vilain.net> > Date: Sun, 11 Feb 2007 12:34:45 +1300 > Subject: [PATCH] git-svn: re-map repository URLs and UUIDs on SVK mirror paths > > If an SVN revision has a property, "svm:headrev", it is likely that > the revision was created by SVN::Mirror (a part of SVK). The property > contains a repository UUID and a revision. We want to make it look > like we are mirroring the original URL, so introduce a helper function > that returns the original identity URL and UUID, and use it when > generating commit messages. Signed-off-by: Eric Wong <normalperson@yhbt.net>