Commit graph

457 commits

Author SHA1 Message Date
Vitor Antunes 807371a926 git-p4: Add description of rename/copy detection options
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 11:49:04 -07:00
Vitor Antunes 0a9feffc47 git-p4: Allow setting rename/copy detection threshold
Copy and rename detection arguments (-C and -M) allow setting a threshold value
for the similarity ratio. If the similarity is below this threshold the rename
or copy is ignored and the file is added as new.
This patch allows setting git-p4.detectRenames and git-p4.detectCopies options
to an integer value to set the respective threshold.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22 11:48:38 -07:00
Pete Wyckoff 4e2e6ce450 git-p4: commit time should be most recent p4 change time
When importing a repo, the time on the initial commit had been
just "now".  But this causes problems when trying to share among
git-p4 repos that were created identically, although at different
times.  Instead, use the time in the top-most p4 change as the
time for the git import commit.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:24:20 -07:00
Luke Diamand 848de9c383 git-p4: warn if git authorship won't be retained
If the git commits you are submitting contain changes made by
other people, the authorship will not be retained. Change git-p4
to warn of this and to note that --preserve-user can be used
to solve the problem (if you have suitable permissions).
The warning can be disabled.

Add a test case and update documentation.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-13 12:59:13 -07:00
Luke Diamand ecdba36da6 git-p4: small improvements to user-preservation
. Slightly more paranoid checking of results from 'p4 change'
. Remove superfluous "-G"
. Don't modify the username if it is unchanged.
. Add a comment in the change template to show what is
  going to be done.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-By: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09 16:26:51 -07:00
Luke Diamand 3ea2cfd488 git-p4: add option to preserve user names
Patches from git passed into p4 end up with the committer being identified
as the person who ran git-p4.

With "submit --preserve-user", git-p4 modifies the p4 changelist (after it
has been submitted), setting the p4 author field.

The submitter is required to have sufficient p4 permissions or git-p4
refuses to proceed. If the git author is not known to p4, the submit will
be abandoned unless git-p4.allowMissingP4Users is true.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-26 11:10:46 -07:00
Andrew Garber c3f6163b0b git-p4: replace each tab with 8 spaces for consistency
Note that the majority of git-p4 uses spaces, not tabs, for indentation.
Consistent indentation is a good hygiene for Python scripts, and mixing
tabs and spaces in Python can lead to hard-to-find bugs.

Signed-off-by: Andrew Garber <andrew@andrewgarber.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-07 00:37:45 -07:00
Junio C Hamano 98b256bd08 Merge branch 'pw/p4'
* pw/p4:
  git-p4: test sync new branch
  git-p4: fix sync new branch regression
2011-03-23 14:54:24 -07:00
Pete Wyckoff accad8e05e git-p4: fix sync new branch regression
e32e00d (git-p4: better message for "git-p4 sync" when not
cloned, 2011-02-19) broke another use case, that of using
"git-p4 sync" to import a new branch into an existing repository.

Refine the fix again, on top of the fix in ac34efc.

Reported-by: Michael Horowitz <michael.horowitz@ieee.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Tested-by: Michael Horowitz <michael.horowitz@ieee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 14:34:16 -07:00
Tor Arvid Lund afa1dd9a46 git-p4: Fix error message crash in P4Sync.commit.
There is an error message that crashes the script because of an invalid ref
to the non-existing "path" variable. It is almost never printed, which
would explain why nobody encountered this problem before... But anyway,
this oneliner fixes it.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-15 16:07:21 -07:00
Tor Arvid Lund d53de8b97d Teach git-p4 to ignore case in perforce filenames if configured.
When files are added to perforce, the path to that file has whichever case
configuration that exists on the machine of the user who added the file.
What does that mean? It means that when Alice adds a file

//depot/DirA/FileA.txt

... and Bob adds:

//depot/dirA/FileB.txt

... we may or may not get a problem. If a user sets the config variable
git-p4.ignorecase to "true", we will consider //depot/DirA and //depot/dirA
to be the same directory.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-15 16:07:15 -07:00
Tor Arvid Lund 99f790f22e git-p4: Teach gitConfig method about arguments.
With this patch, it is possible to call the gitConfig method with an optional
argument string, which will be passed to the "git config" executable. For
instance:

gitConfig("core.ignorecase", "--bool")

will ensure that you get the value "true", and won't have to check the returned
value for [1, true, on, yes].

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-15 16:06:58 -07:00
Junio C Hamano ae4479d494 Merge branch 'pw/p4'
* pw/p4:
  git-p4: test clone @all
  git-p4: fix clone @all regression
2011-03-13 00:10:06 -08:00
Pete Wyckoff ac34efcf21 git-p4: fix clone @all regression
e32e00d (git-p4: better message for "git-p4 sync" when not cloned,
2011-02-19) broke the use of the "@all" revision specifier, e.g.,

    git-p4 clone //depot/xxx@all

Fix it as per Tor Arvid's quick patch.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Reported-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Based-on-patch-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-13 00:06:25 -08:00
Junio C Hamano 6d74e5c9db Merge branch 'mh/p4'
* mh/p4:
  git-p4 submit: prevent 'Jobs' section from being removed from p4 change log
2011-03-04 15:02:28 -08:00
Junio C Hamano 5e3d39ba8a Merge branch 'va/p4'
* va/p4:
  git-p4: Add copy detection support
  git-p4: Improve rename detection support
2011-02-27 21:58:30 -08:00
Junio C Hamano 8d3a362028 Merge branch 'pw/p4'
* pw/p4:
  git-p4: support clone --bare
  git-p4: decode p4 wildcard characters
  git-p4: better message for "git-p4 sync" when not cloned
  git-p4: reinterpret confusing p4 message
  git-p4: accommodate new move/delete type in p4
  git-p4: add missing newline in initial import message
  git-p4: fix key error for p4 problem
  git-p4: test script
2011-02-27 21:58:30 -08:00
Michael Horowitz c9dbab045d git-p4 submit: prevent 'Jobs' section from being removed from p4 change log
In an attempt to overwrite the 'Description:' section of the p4 change
log to include the git commit messages, it also overwrote the 'Jobs:'
section.  This fix restores the 'Job:' section.

Signed-off-by: Michael Horowitz <michael.horowitz@ieee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-25 23:39:41 -08:00
Vitor Antunes 4fddb41bd7 git-p4: Add copy detection support
Add new config options:
    git-p4.detectCopies         - Enable copy detection.
    git-p4.detectCopiesHarder   - Find copies harder.
The detectCopies option should be set to a true/false value.
The detectCopiesHarder option should be set to true/false value.
P4Submit can now process diff-tree C status and integrate files accordingly.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Acked-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 10:58:16 -08:00
Vitor Antunes ae901090f7 git-p4: Improve rename detection support
Only open files for edit after integrating if the SHA1 of source and destination
differ from each other.
Add git config option detectRenames to allow permanent rename detection. This
options should be set to a true/false value.
Rename "detectRename" variable to "detectRenames" to make it more coherent with
the description in git man pages, which always use plural.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Acked-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 10:58:02 -08:00
Pete Wyckoff 3820007694 git-p4: support clone --bare
Just like git clone --bare, build a .git directory but no
checked out files.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 10:05:44 -08:00
Pete Wyckoff 084f6306d4 git-p4: decode p4 wildcard characters
There are four wildcard characters in p4.  Files with these
characters can be added to p4 repos using the "-f" option.
They are stored in %xx notation, and when checked out, p4
converts them back to normal.

This patch does the same thing when importing into git,
converting the four special characters.  Without this change,
the files appear with literal %xx in their names.

Be careful not to produce "*" in filenames on windows.  That
will fail.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 09:58:38 -08:00
Pete Wyckoff e32e00dc88 git-p4: better message for "git-p4 sync" when not cloned
A common error is to do "git-p4 sync" in a repository that
was not initialized by "git-p4 clone".  There will be no
p4 refs.  The error message in this case is a traceback
for an assertion, which is confusing.

Change it instead to explain the likely problem.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 09:57:29 -08:00
Pete Wyckoff d88e707f17 git-p4: reinterpret confusing p4 message
Error output will look like this:

glom$ git p4 clone //deopt
Importing from //deopt into .
Reinitialized existing Git repository in /tmp/x/.git/
Doing initial import of //deopt from revision #head into refs/remotes/p4/master
p4 returned an error: //deopt/... - must refer to client glom.

This particular p4 error is misleading.
Perhaps the depot path was misspelled.
Depot path:  //deopt

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 09:56:56 -08:00
Pete Wyckoff 56c093451c git-p4: accommodate new move/delete type in p4
562d53f (git-p4: Fix sync errors due to new server version, 2010-01-21)
taught git-p4 sync to recognize the new move/delete type, but this type
can also show up in an initial clone and labels output.

Instead of replicating the support in three places, hoist the definition
somewhere global.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 09:52:46 -08:00
Pete Wyckoff 1494fcbb75 git-p4: add missing newline in initial import message
Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-By: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 09:51:48 -08:00
Pete Wyckoff 68b2859389 git-p4: fix key error for p4 problem
Some p4 failures result in an error, but the info['code'] is not
set.  These include a bad p4 executable, or a core dump from p4,
and other odd internal errors where p4 fails to generate proper
marshaled output.

Make sure the info key exists before using it to avoid a python
traceback.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21 09:50:16 -08:00
Ian Wienand 3952710bfa Obey p4 views when using client spec
When using the p4 client spec, this attempts to obey the client's
output preferences.

For example, a view like

//depot/foo/branch/... //client/branch/foo/...
//depot/bar/branch/... //client/branch/bar/...

will result in a directory layout in the git tree of

branch/
branch/foo
branch/bar

p4 can do various other reordering that this change doesn't support,
but we should detect it and at least fail nicely.

Signed-off-by: Ian Wienand <ianw@vmware.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Acked-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-14 10:34:49 -08:00
Junio C Hamano 3089c2b97a Merge branch 'aw/git-p4-deletion'
* aw/git-p4-deletion:
  Fix handling of git-p4 on deleted files
2010-11-05 10:42:46 -07:00
Andrew Waters 8b130262fb Fix handling of git-p4 on deleted files
Signed-off-by: Andrew Waters <apwaters@googlemail.com>
Tested-by: Thomas Berg <merlin66b@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-22 11:51:10 -07:00
Ævar Arnfjörð Bjarmason 3328acedc6 perl: use "use warnings" instead of -w
Change the Perl scripts to turn on lexical warnings instead of setting
the global $^W variable via the -w switch.

The -w sets warnings for all code that interpreter runs, while "use
warnings" is lexically scoped. The former is probably not what the
authors wanted.

As an auxiliary benefit it's now possible to build Git with:

    PERL_PATH='/usr/bin/env perl'

Which would previously result in failures, since "#!/usr/bin/env perl -w"
doesn't work as a shebang.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27 12:37:56 -07:00
Junio C Hamano 4de113cdf5 Merge branch 'rb/maint-python-path'
* rb/maint-python-path:
  Correct references to /usr/bin/python which does not exist on FreeBSD
2010-04-03 12:28:41 -07:00
R. Tyler Ballance 44211e8c2e Correct references to /usr/bin/python which does not exist on FreeBSD
On FreeBSD, Python does not ship as part of the base system but is available
via the ports system, which install the binary in /usr/local/bin.

Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24 14:33:54 -07:00
Benjamin C Meyer 6a01298a7e Fix a spelling mistake in a git-p4 console message
Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20 09:18:48 -07:00
Evan Powers b39c3612eb git-p4: fix bug in symlink handling
Fix inadvertent breakage from b932705 (git-p4: stream from perforce to
speed up clones, 2009-07-30) in the code that strips the trailing '\n'
from p4 print on a symlink. (In practice, contents is of the form
['target\n', ''].)

Signed-off-by: Evan Powers <evan.powers@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-20 08:38:21 -08:00
Junio C Hamano 9517e6b843 Typofixes outside documentation area
begining -> beginning
    canonicalizations -> canonicalization
    comand -> command
    dewrapping -> unwrapping
    dirtyness -> dirtiness
    DISCLAMER -> DISCLAIMER
    explicitely -> explicitly
    feeded -> fed
    impiled -> implied
    madatory -> mandatory
    mimick -> mimic
    preceeding -> preceding
    reqeuest -> request
    substition -> substitution

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-03 21:28:17 -08:00
Pal-Kristian Engstad 562d53fa69 git-p4: Fix sync errors due to new server version
Fix sync errors due to new Perforce servers.

The P4D/NTX64/2009.2/228098 (2009/12/16) server reports
'move/delete' instead of 'delete'. This causes the Perforce
depot and the git repo to get out of sync. Fixed by adding
the new status string.

Signed-off-by: Pal-Kristian Engstad <pal_engstad@naughtydog.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-01 12:08:14 -08:00
Nicolas Pitre 8b187e6b0e fix git-p4 editor invocation
The strip() is required to remove the trailing newline character,
as already done elsewhere.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 22:02:28 -08:00
Jonathan Nieder b4479f0747 add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"
Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13 12:20:50 -08:00
Ingmar Vanhassel 2a94552887 import-tars: Add support for tarballs compressed with lzma, xz
Also handle the extensions .tlz and .txz, aliases for .tar.lzma and
.tar.xz respectively.

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
Liked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-21 17:15:43 -07:00
Ingmar Vanhassel b6aaaa4470 import-tars: Add missing closing bracket
This fixes an obvious syntax error that snuck in commit 7e787953:

  syntax error at /home/ingmar/bin//git-import-tars line 143, near "/^$/ { "
  syntax error at /home/ingmar/bin//git-import-tars line 145, near "} else"
  syntax error at /home/ingmar/bin//git-import-tars line 152, near "}"

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
Acked-and-Tested-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-09 14:58:13 -07:00
Junio C Hamano 4a452ede39 Merge branch 'pk/fast-import-tars'
* pk/fast-import-tars:
  import-tars: Allow per-tar author and commit message.
2009-09-13 01:33:29 -07:00
Junio C Hamano d821c003f8 Merge branch 'pk/fast-import-dirs'
* pk/fast-import-dirs:
  Add script for importing bits-and-pieces to Git.
2009-09-13 01:33:26 -07:00
Reilly Grant 1d7367dce7 git-p4: Avoid modules deprecated in Python 2.6.
The popen2, sha and sets modules are deprecated in Python 2.6 (sha in
Python 2.5).  Both popen2 and sha are not actually used in git-p4.
Replace usage of sets.Set with the builtin set object.

The built-in set object was added in Python 2.4 and is already used in
other parts of this script, so this dependency is nothing new.

Signed-off-by: Reilly Grant <reillyeon@qotw.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-10 11:22:22 -07:00
Peter Krefting 2b72ccb20a Add script for importing bits-and-pieces to Git.
Allows the user to import version history that is stored in bits and
pieces in the file system, for instance snapshots of old development
trees, or day-by-day backups. A configuration file is used to
describe the relationship between the different files and allow
describing branches and merges, as well as authorship and commit
messages.

Output is created in a format compatible with git-fast-import.

Full documentation is provided inline in perldoc format.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-03 09:49:13 -07:00
Peter Krefting 7e787953fb import-tars: Allow per-tar author and commit message.
If the "--metainfo=<ext>" option is given on the command line, a file
called "<filename.tar>.<ext>" will be used to create the commit message
for "<filename.tar>", instead of using "Imported from filename.tar".

The author and committer of the tar ball can also be overridden by
embedding an "Author:" or "Committer:" header in the metainfo file.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-03 09:44:41 -07:00
Luke Diamand b932705b45 git-p4: stream from perforce to speed up clones
Change commit() to stream data from Perforce and into fast-import
rather than reading into memory first, and then writing out. This
hugely reduces the memory requirements when cloning non-incrementally.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-10 14:25:20 -07:00
Johannes Schindelin 6fb37f86bc import-tars: support symlinks
Without this patch, symbolic links are turned into empty files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 09:53:53 -07:00
Junio C Hamano f2ad051fd1 Merge branch 'maint'
* maint:
  git-svn: fix ls-tree usage with dash-prefixed paths
  import-zips: fix thinko
2009-03-29 23:11:23 -07:00
Junio C Hamano 510a309e5e Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  import-zips: fix thinko
2009-03-29 23:11:13 -07:00
Junio C Hamano 8e4f767ba7 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  import-zips: fix thinko
2009-03-29 23:11:03 -07:00
Johannes Schindelin 63801da88d import-zips: fix thinko
Embarrassingly, the common prefix calculation did not work properly, due
to a mistake in the assignment: instead of assigning the dirname of the
current file name, the dirname of the current common prefix needs to
be assigned to common prefix, when the current prefix does not match the
current file name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:56:26 -07:00
Giuseppe Bilotta 6872f606d9 import-tars: separate author from committer
The import-tars script is typically employed to (re)create the past
history of a project from stored tars. Although assigning authorship in
these cases can be a somewhat arbitrary process, it makes sense to set
the author to whoever created the tars in the first place (if it's
known), and (s)he can in general be different from the committer
(whoever is running the script).

Implement this by having separate author and committer data, making them
settable from the usual GIT_* environment variables.

Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-20 09:33:28 -07:00
Pete Wyckoff 3b167396b4 git-p4: remove tabs from usermap file
Some users have tabs in their names, oddly enough.  This
causes problems when loading the usercache from disk,
as split separates the fields on the wrong tabs.  When
fast-import's parse_ident() tries to parse the committer
field, it is unhappy about the unbalanced <..> angle brackets.

It is easy enough to convert the tabs to single spaces.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-07 20:32:07 -08:00
Pete Wyckoff b4b0ba06f8 git-p4: avoid syncing duplicate changes
When a particular changeset affects multiple depot paths, it
will appear multiple times in the output of "p4 changes".
Filter out the duplicates to avoid the extra empty commits that
this otherwise would create.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-23 15:24:08 -08:00
Tor Arvid Lund 75bc9573b0 git-p4: Fix regression in p4Where method.
Unfortunately, I introduced a bug in commit 7f705dc36 (git-p4: Fix bug in
p4Where method). This happens because sometimes the result from
"p4 where <somepath>" doesn't contain a "depotFile" key, but instead a
"data" key that needs further parsing. This commit should ensure that both
of these cases are checked.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-09 21:39:16 -08:00
Tor Arvid Lund 7f705dc368 git-p4: Fix bug in p4Where method.
When running:

p4 where //depot/SomePath/...

The result can in some situations look like:

//depot/SomePath/... //client/SomePath/... /home/user/p4root/SomePath/...
-//depot/SomePath/UndesiredSubdir/... //client/SomePath/UndesiredSubdir/... /home/user/p4root/SomePath/UndesiredSubdir/...

This depends on the users Client view. The current p4Where method will now
return /home/user/p4root/SomePath/UndesiredSubdir/... which is not what we
want. This patch loops through the results from "p4 where", and picks the one
where the depotFile exactly matches the given depotPath (//depot/SomePath/...
in this example).

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-04 18:44:16 -08:00
Junio C Hamano 455d0f5c23 Merge branch 'maint'
* maint:
  sha1_file.c: resolve confusion EACCES vs EPERM
  sha1_file: avoid bogus "file exists" error message
  git checkout: don't warn about unborn branch if -f is already passed
  bash: offer refs instead of filenames for 'git revert'
  bash: remove dashed command leftovers
  git-p4: fix keyword-expansion regex
  fast-export: use an unsorted string list for extra_refs
  Add new testcase to show fast-export does not always exports all tags
2008-11-27 19:23:51 -08:00
Pete Wyckoff 3d51c853df git-p4: fix keyword-expansion regex
This text:

     my $dir = $File::Find::dir;
     return if ($dir !~ m,$options->{dirpat}$,);

was improperly converted to:

     my $dir = $File$dir !~ m,$options->{dirpat}$,);

by the keyword identifier expansion code.  Add a \n
to make sure the regex doesn't go across end-of-line
boundaries.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-27 13:17:58 -08:00
John Chapman 36bd844658 git-p4: Cache git config for performance
This makes git-p4 noticibly faster on Windows.

Signed-off-by: John Chapman <thestar@fussycoder.id.au>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-11 14:50:03 -08:00
John Chapman 7f96e2e25a git-p4: Support purged files and optimize memory usage
Purged files are handled as if they are merely deleted, which is not
entirely optimal, but I don't know of any other way to handle them.
File data is deleted from memory as early as they can, and they are more
efficiently handled, at (significant) cost to CPU usage.

Still need to handle p4 branches with spaces in their names.
Still need to make git-p4 clone more reliable.
 - Perhaps with a --continue option. (Sometimes the p4 server kills
 the connection)

Signed-off-by: John Chapman <thestar@fussycoder.id.au>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-11 14:50:03 -08:00
Tor Arvid Lund e990501312 git-p4: Fix checkout bug when using --import-local.
When this option is passed to git p4 clone, the checkout at the end would
previously fail. This patch fixes it by optionally creating the master branch
from refs/heads/p4/master, which is the correct one for this option.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Acked-By: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29 00:15:47 -07:00
Simon Hausmann cdc7e388da Make it possible to abort the submission of a change to Perforce
Currently it is not possible to skip the submission of a change to Perforce
when running git-p4 submit. This patch compares the modification time before
and after the submit editor invokation and offers a prompt for skipping if
the submit template file was not saved.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27 12:19:47 -07:00
Simon Hausmann f5f7e4a18c Clean up the git-p4 documentation
This patch massages the documentation a bit for improved readability and cleans
it up from outdated options/commands.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-24 12:00:14 -07:00
Tor Arvid Lund 893d340f2c git-p4: Fix one-liner in p4_write_pipe function.
The function built a p4 command string via the p4_build_cmd function, but
ignored the result.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-22 22:40:13 -07:00
Junio C Hamano a1975c4fea Merge branch 'ak/p4'
* ak/p4:
  Utilise our new p4_read_pipe and p4_write_pipe wrappers
  Add p4 read_pipe and write_pipe wrappers
  Put in the two other configuration elements found in the source
  Put some documentation in about the parameters that have been added
  Move git-p4.syncFromOrigin into a configuration parameters section
  Consistently use 'git-p4' for the configuration entries
  If the user has configured various parameters, use them.
  Switch to using 'p4_build_cmd'
  If we are in verbose mode, output what we are about to run (or return)
  Add a single command that will be used to construct the 'p4' command
  Utilise the new 'p4_system' function.
  Have a command that specifically invokes 'p4' (via system)
  Utilise the new 'p4_read_pipe_lines' command
  Create a specific version of the read_pipe_lines command for p4 invocations

Conflicts:
	contrib/fast-import/git-p4
2008-08-17 10:53:57 -07:00
Robert Blum 053fd0c1c3 git-p4: chdir now properly sets PWD environment variable in msysGit
P4 on Windows expects the PWD environment variable to be set to the
current working dir, but os.chdir in python doesn't do so.

Signed-off-by: Robert Blum <rob.blum@gmail.com>
Acked-by: Simon Hausmann <simon@lst.de>
Acked-by: Han-Wen Nienhuys <hanwen@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 23:37:04 -07:00
Anand Kumria a7d3ef9d09 Utilise our new p4_read_pipe and p4_write_pipe wrappers
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 18:14:24 -07:00
Anand Kumria d9429194f6 Add p4 read_pipe and write_pipe wrappers
Two additional wrappers to cover 3 places where we utilise p4 in piped
form.  Found by Tor Arvid Lund.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 18:14:23 -07:00
Anand Kumria 5b5aa22f00 Put in the two other configuration elements found in the source
I am not entirely clear what these parameters do but felt it
 useful to call them out in the documentation.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria b87a659635 Put some documentation in about the parameters that have been added
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria bc02acfc76 Move git-p4.syncFromOrigin into a configuration parameters section
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria 3cafb7d8ce Consistently use 'git-p4' for the configuration entries
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria abcaf07360 If the user has configured various parameters, use them.
Some repositories require authentication and access to certain
 hosts. Allow git-p4 to pull this information from the configuration

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria 155af83491 Switch to using 'p4_build_cmd'
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria ee06427aa6 If we are in verbose mode, output what we are about to run (or return)
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria 21a5075385 Add a single command that will be used to construct the 'p4' command
Rather than having three locations where the 'p4' command is built up,
 refactor this into the one place. This will, eventually, allow us to
 have one place where we modify the evironment or pass extra
 command-line options to the 'p4' binary.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:04 -07:00
Anand Kumria 87b611d5fd Utilise the new 'p4_system' function.
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:03 -07:00
Anand Kumria bf9320f151 Have a command that specifically invokes 'p4' (via system)
Similiar to our 'p4_read_pipe_lines' command, we can isolate
 specific changes to the invocation method in the one location
 with this change.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:03 -07:00
Anand Kumria b340fa4301 Utilise the new 'p4_read_pipe_lines' command
Now that we have the new command, we can utilise it and then
 eventually, isolate any changes required to the one place.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:03 -07:00
Anand Kumria 2318121bab Create a specific version of the read_pipe_lines command for p4 invocations
This will make it easier to isolate changes to how 'p4' is invoked
 (whether with parameters or not, etc.).

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-11 18:57:03 -07:00
Daniel Barkalow 2d71bde2d1 In perforce, RCS keywords are case-sensitive
At least, this is true in 2007.2, according to the documentation.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:33:34 -07:00
Johannes Schindelin be612c2318 Add another fast-import example, this time for .zip files
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01 00:48:17 -07:00
Jing Xue 4c2d5d722c Add 'git-p4.allowSubmit' to git-p4
I'm working with a perforce repo using git-p4. There are some config
files which I need to change locally according to my environment. I'm
using a 'local' git branch to park these changes. And I want to avoid
accidentally checking them into p4 just by doing "git p4 submit"
mindlessly without realizing which branch I'm actually on.

This patch adds a new git config, 'git-p4.allowSubmit', which is a
whitelist of branch names. "git p4 submit" will only allow submissions
from local branches on the list. Useful for preventing inadvertently
submitting from a strictly local branch.

For backward compatibility, if this config is not set at all,
submissions from all branches are allowed.

Signed-off-by: Jing Xue <jingxue@digizenstudio.com>
Acked-By: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-26 12:10:42 -07:00
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