1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 05:26:29 +02:00
Commit Graph

215 Commits

Author SHA1 Message Date
Marius Storm-Olsen f3e5ae4f06 git-p4: Handle Windows EOLs properly after removal of p4 submit template handling.
git-p4s handling of Windows style EOL was broken after the removal
of the p4 submit template handling in commit f2a6059. Fix that, and
make getP4OpenedType() more robust.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-28 16:27:39 +01:00
Shawn Bohrer 82cea9ffb1 git-p4: Use P4EDITOR environment variable when set
Perforce allows you to set the P4EDITOR environment variable to your
preferred editor for use in perforce.  Since we are displaying a
perforce changelog to the user we should use it when it is defined.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-13 08:57:29 +01:00
Shawn Bohrer 67abd41716 git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'
A custom diffing utility can be specified for the 'p4 diff' command by
setting the P4DIFF environment variable.  However when using a custom
diffing utility such as 'vimdiff' passing options like -du can cause
unexpected behavior.

Since the goal is to generate a unified diff of the changes and attach
them to the bottom of the p4 submit log we should unset P4DIFF if it
has been set in order to generate the diff properly.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-13 08:57:29 +01:00
Marius Storm-Olsen 8ff45f2af5 git-p4: Optimize the fetching of data from perforce.
Use shallow copies in loop, and join content at the end. Then do the substitution, if needed.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-13 08:57:29 +01:00
Simon Hausmann 30b5940bcd git-p4: Fix import of changesets with file deletions
Commit 3a70cdfa42 made readP4Files abort quickly
when the changeset only contains files that are marked for deletion with an empty return
value, which caused the commit to not do anything.

This commit changes readP4Files to distinguish between files that need to be passed to p4
print and files that have no content ("deleted") and merge them in the returned
list.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-03 21:53:51 -08:00
Tor Arvid Lund 3a70cdfa42 git-p4: Support usage of perforce client spec
When syncing, git-p4 will only download files that are included in the active
perforce client spec. This does not change the default behaviour - it requires
that the user either supplies the command line argument --use-client-spec, or
sets the git config option p4.useclientspec to "true".

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27 16:27:13 +01:00
Simon Hausmann 4c750c0d8b git-p4: git-p4 submit cleanups.
Removed storing the list of commits in a configuration file. We only need the list
of commits at run-time.

Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27 16:27:10 +01:00
Simon Hausmann 0e36f2d726 git-p4: Removed git-p4 submit --direct.
This feature was originally meant to allow for quicker direct submits into perforce, but
it turns out that it is not actually quicker than doing a git commit and then running
git-p4 submit.

Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27 16:27:07 +01:00
Simon Hausmann edae1e2f40 git-p4: Clean up git-p4 submit's log message handling.
Instead of trying to substitute fields in the p4 submit template we now simply
replace the description of the submit with the log message of the git commit.

Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27 16:27:03 +01:00
Simon Hausmann 4b61b5c963 git-p4: Remove --log-substitutions feature.
This turns out to be rarely useful and is already covered by git's commit.template configuration variable.

Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27 16:26:57 +01:00
Tommy Thorn 354081d5a0 git-p4: support exclude paths
Teach git-p4 about the -/ option which adds depot paths to the exclude
list, used when cloning. The option is chosen such that the natural
Perforce syntax works, eg:

  git p4 clone //branch/path/... -//branch/path/{large,old}/...

Trailing ... on exclude paths are optional.

This is a generalization of a change by Dmitry Kakurin (thanks).

Signed-off-by: Tommy Thorn <tommy-git@thorn.ws>
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27 15:17:05 +01:00
Toby Allsopp 053d9e432b git-p4: Fix indentation from tab to spaces
Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
2008-02-07 00:39:08 -08:00
Tommy Thorn 147402a2e9 git-p4: Fix an obvious typo
The regexp "$," can't match anything. Clearly not intended.

This was introduced in ce6f33c8 which is quite a while ago.

Signed-off-by: Tommy Thorn <tommy-git@thorn.ws>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-03 13:00:15 -08:00
Simon Hausmann 36ee4ee40e git-p4: Ensure the working directory and the index are clean before "git-p4 rebase"
Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-03 19:19:16 +01:00
Simon Hausmann e96e400f67 git-p4: Fix submit user-interface.
Don't ask any questions when submitting, behave similar to git-svn dcommit.

Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-03 19:19:05 +01:00
Jason McMullan f3e9512be1 Remove $Id: ..$ $Header: ..$ etc from +ko and +k files during import
This patch removes the '$Keyword: ...$' '...' data, so that files
don't have spurious megre conflicts between branches.

Handles both +ko and +k styles, and leaves the '$Foo$' in
the original file.

Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-03 19:18:33 +01:00
Shun Kei Leung 183f84365d git-p4: Fix typo in --detect-labels
Signed-off-by: Kevin Leung <kevinlsk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-20 23:27:44 -08:00
Simon Hausmann 38f9f5ec41 git-p4: Fix direct import from perforce after fetching changes through git from origin
When using an existing git repository to cache the perforce import we don't
fetch the branch mapping from perforce as that is a slow operation. However
the origin repository may not be fully up-to-date and therefore it may be
necessary to import more changes directly from Perforce.

Such a direct import needs self.knownBranches to be set up though, so
initialize it from the existing p4/* git branches.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-16 01:32:59 -08:00
Chris Pettitt c65b670e85 git-p4: Detect changes to executable bit and include them in p4 submit.
This changeset takes advantage of the new parseDiffTreeEntry(...) function to
detect changes to the execute bit in the git repository.  During submit, git-p4
now looks for changes to the executable bit and if it finds them it "reopens"
the file in perforce, which allows it to change the file type.

The logic for adding the executable bit in perforce is straightforward: the +x
modifier can be used. Removing the executable bit in perforce requires that the
entire filetype be redefined (there is no way to join remove the bit with a -x
modifier, for example). This changeset includes logic to remove the executable
bit from the full file type while preserving the base file type and other
modifiers.

Signed-off-by: Chris Pettitt <cpettitt@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 02:01:32 -07:00
Chris Pettitt b43b0a3c5c git-p4: Add a helper function to parse the full git diff-tree output.
Signed-off-by: Chris Pettitt <cpettitt@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 02:01:32 -07:00
Chris Pettitt d9a5f25b67 git-p4 support for perforce renames.
The current git-p4 implementation does support file renames. However, because
it does not use the "p4 integrate" command, the history for the renamed file is
not linked to the new file.

This changeset adds support for perforce renames with the integrate command.
Currently this feature is only enabled when calling git-p4 submit with the -M
option. This is intended to look and behave similar to the "detect renames"
feature of other git commands.

The following sequence is used for renamed files:

    p4 integrate -Dt x x'
    p4 edit x'
    rm x'
    git apply
    p4 delete x

By default, perforce will not allow an integration with a target file that has
been deleted. That is, if x' in the example above is the name of a previously
deleted file then perforce will fail the integrate. The -Dt option tells
perforce to allow the target of integrate to be a previously deleted file.

Signed-off-by: Chris Pettitt <cpettitt@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-10-20 17:12:16 +02:00
Simon Hausmann 209471493a git-p4: When skipping a patch as part of "git-p4 submit" make sure we correctly revert to the previous state of the files using "p4 revert".
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-10-20 17:12:02 +02:00
Marius Storm-Olsen a9834f5833 Add 'git-p4 commit' as an alias for 'git-p4 submit'
Given that git uses 'commit', git-p4's 'sumbit' was a bit confusing at times;
often making me do 'git submit' and 'git-p4 commit' instead.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-By: Simon Hausmann <simon@lst.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:30:31 -04:00
Junio C Hamano 4f337e2466 Merge branch 'maint'
* maint:
  git-svn: don't attempt to spawn pager if we don't want one
  Supplant the "while case ... break ;; esac" idiom
  User Manual: add a chapter for submodules
  user-manual: don't assume refs are stored under .git/refs
  Detect exec bit in more cases.
  Conjugate "search" correctly in the git-prune-packed man page.
  Move the paragraph specifying where the .idx and .pack files should be
  Documentation/git-lost-found.txt: drop unnecessarily duplicated name.
2007-09-23 17:13:55 -07:00
David Brown b9fc6ea9ef Detect exec bit in more cases.
git-p4 was missing the execute bit setting if the file had other attribute
bits set.

Acked-By: Simon Hausmann <simon@lst.de>
2007-09-22 15:41:50 -07:00
Simon Hausmann 1ca3d71069 git-p4: Added support for automatically importing newly appearing perforce branches.
If a change in a p4 "branch" appears that hasn't seen any previous commit and
that has a known branch mapping we now try to import it properly. First we
find the p4 change of the source branch that the new p4 branch is based on. Then
we using git rev-list --bisect to locate the corresponding git commit to that change.
Finally we import all changes in the new p4 branch up to the current change and resume
with the regular import.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:39 +02:00
Simon Hausmann 8134f69c21 git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:37 +02:00
Simon Hausmann c208a24310 git-p4: Cleanup; moved the code for the initial #head or revision import into a separate function, out of P4Sync.run.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:25 +02:00
Simon Hausmann 1c49fc197b git-p4: Cleanup; Turn self.revision into a function local variable (it's not used anywhere outside the function).
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:13 +02:00
Simon Hausmann e87f37ae42 git-p4: Cleanup; moved the code to import a list of p4 changes using fast-import into a separate member function of P4Sync.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:34:56 +02:00
Simon Hausmann 4f6432d8cc git-p4: Cleanup; moved the code for getting a sorted list of p4 changes for a list of given depot paths into a standalone method.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:34:32 +02:00
Simon Hausmann 14594f4b57 git-p4: After submission to p4 always synchronize from p4 again (into refs/remotes). Whether to rebase HEAD or not is still left as question to the end-user.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:27:02 +02:00
Simon Hausmann 31f9ec129e git-p4: Always call 'p4 sync ...' before submitting to Perforce.
Acked-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-by: Thiago Macieira <thiago@kde.org>
2007-09-03 20:27:02 +02:00
Simon Hausmann 0058a33a8e git-p4: Fix warnings about non-existant refs/remotes/p4/HEAD ref when running git-p4 sync the first time after a git clone.
Don't create the p4/HEAD symbolic ref if p4/master doesn't exist yet.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24 18:54:37 -07:00
Simon Hausmann 5ca4461728 git-p4: Make 'git-p4 branches' work after an initial clone with git clone from an origin-updated repository.
After a clone with "git clone" of a repository the p4 branches are only in remotes/origin/p4/* and not in remotes/p4/*.
Separate the code for detection and creation out of the P4Sync command class into standalone methods and use them
from the P4Branches command.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24 18:54:37 -07:00
Reece H. Dunn 7da660f437 git-p4: Fix the sorting of changelists when cloning a Perforce repository.
When performing a git-p4 clone operation on a Perforce repository,
where the changelists change in order of magnitude (e.g. 100 to 1000),
the set of changes to import from is not sorted properly. This is
because the data in the list is strings not integers. The other place
where this is done already converts the value to an integer, so it is
not affected.

Acked-by: Simon Hausmann <simon@lst.de>
2007-08-13 15:23:14 -07:00
Simon Hausmann ea99c3ae0e git-p4: Fix git-p4 submit to include only changed files in the perforce submit template.
Parse the files section in the "p4 change -o" output and remove lines with file changes in unrelated depot paths.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08 13:45:04 -07:00
Simon Hausmann 74276ec6f2 git-p4: Fix support for symlinks.
Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output.
Make the mode handling a bit more readable at the same time.

Signed-off-by: Simon Hausmann <simon@lst.de>
Acked-by: Brian Swetland <swetland@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08 01:58:05 -07:00
Han-Wen Nienhuys 7fcff9def5 Fix style nit in Python slicing.
Python slices start at 0 by default.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02 09:40:28 +02:00
Han-Wen Nienhuys a4eba020f9 Sort output of "p4 change" in incremental import before further
processing

P4 change outputs the changes sorted for each directory separately. We
want the global ordering on the changes, hence we sort.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02 09:40:25 +02:00
Simon Hausmann b2d2d16af7 git-p4: Fix p4 user cache population on Windows.
Fall back to USERPROFILE if HOME isn't set.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 16:06:54 -07:00
Simon Hausmann 144ff46b19 git-p4: Cleanup, used common function for listing imported p4 branches
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-18 17:29:38 +02:00
Simon Hausmann 86506fe54c git-p4: Fix upstream branch detection for submit/rebase with multiple branches.
Don't use git name-rev to locate the upstream git-p4 branch for rebase and submit but instead locate the branch by comparing the depot paths.
name-rev may produce results like wrongbranch~12 as it uses the first match.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18 17:29:31 +02:00
Simon Hausmann 062410bb9d git-p4: Cleanup, make listExistingP4Branches a global function for later use.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18 17:29:05 +02:00
Scott Lamb 788001908c git-p4: input to "p4 files" by stdin instead of arguments
This approach, suggested by Alex Riesen, bypasses the need for xargs-style
argument list handling. The handling in question looks broken in a corner
case with SC_ARG_MAX=4096 and final argument over 96 characters.

Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17 08:35:33 +02:00
Scott Lamb 9f90c7335e git-p4: use subprocess in p4CmdList
This allows bidirectional piping - useful for "-x -" to avoid commandline
arguments - and is a step toward bypassing the shell.

Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17 08:35:24 +02:00
Marius Storm-Olsen 48b4c3d5ab Fix git-p4 on Windows to not use the Posix sysconf function.
Add condition for Windows, since it doesn't support the os.sysconf module.
We hardcode the commandline limit to 2K, as that should work on most
Windows platforms.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-14 22:47:14 -04:00
Simon Hausmann 9ceab36375 Make it possible to specify the HEAD for the internal findUpstreamBranchPoint function.
This isn't used right now in git-p4 but I use it in an external script that loads git-p4 as module.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-22 00:00:34 +02:00
Simon Hausmann 09d89de2e3 Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-20 23:13:20 +02:00
Simon Hausmann 1a2edf4e8d Warn about conflicting p4 branch mappings and use the first one found.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 15:10:24 +02:00