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
Shawn O. Pearce
610f043bb3
Import branch 'git-p4' of git://repo.or.cz/fast-export
...
Simon has asked that the git.git project include the git-p4 project
as at least a contrib/fast-import within git.git. I think it makes
a lot of sense, as git-p4 nicely complements the only other in-tree
fast-import user: import-tars.perl.
git-p4 is offered under the MIT license by its authors.
2007-06-22 19:16:22 -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
Simon Hausmann
6555b2ccfe
Fix the branch mapping detection to be independent from the order of the "p4 branches" output.
...
Collect "unknown" source branches separately and register them at the end.
Also added a minor speed up to splitFilesIntoBranches by breaking out of the loop through all branches when it's safe.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 11:25:59 +02:00
Benjamin Sergeant
da4a660161
git-p4 fails when cloning a p4 depo.
...
A perforce command with all the files in the repo is generated to get
all the file content.
Here is a patch to break it into multiple successive perforce command
who uses 4K of parameter max, and collect the output for later.
It works, but not for big depos, because the whole perforce depo
content is stored in memory in P4Sync.run(), and it looks like mine is
bigger than 2 Gigs, so I had to kill the process.
[Simon: I added the bit about using SC_ARG_MAX, as suggested by Han-Wen]
Signed-off-by: Benjamin Sergeant <bsergean@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-16 22:06:06 +02:00
Simon Hausmann
3c699645f5
Fix initial multi-branch import.
...
The list of existing p4 branches in git wasn't initialized.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-16 13:09:21 +02:00
Marius Storm-Olsen
cbae7080a7
Only use double quotes on Windows
...
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-12 15:27:52 +02:00
Simon Hausmann
d7e3868cdf
Fix git-p4 rebase to detect the correct upstream branch instead of unconditionally
...
always rebasing on top of remotes/p4/master
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-12 14:34:46 +02:00
Simon Hausmann
27d2d8119b
Moved the code from git-p4 submit to figure out the upstream branch point
...
into a separate helper method.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-12 14:31:59 +02:00
Simon Hausmann
e6b711f00e
git-p4 submit: Fix missing quotes around p4 commands to make them work with spaces in filenames
...
Noticed by Alex Riesen
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 23:41:41 +02:00
Simon Hausmann
81b462a629
Mention remotes/p4/master also in the documentation.
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 23:30:23 +02:00
Simon Hausmann
a9d1a27af1
Provide some information for single branch imports where the commits go
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 23:28:03 +02:00
Kevin Green
c3bf3f1301
git-p4: check for existence of repo dir before trying to create
...
When using git-p4 in this manner:
git-p4 clone //depot/path/project myproject
If "myproject" already exists as a dir, but not a valid git repo, it fails
to create the directory.
Signed-off-by: Kevin Green <Kevin.Green@morganstanley.com>
2007-06-11 23:15:38 +02:00
Simon Hausmann
6581de096e
Write out the options tag in the log message of imports only if we actually have
...
options
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 10:01:58 +02:00
Simon Hausmann
a43ff00c7c
Fix support for explicit disabling of syncing with the origin
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 09:59:27 +02:00
Simon Hausmann
86fda6a327
Fix depot-paths encoding for multi-path imports (don't split up //depot/path/foo)
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 08:54:45 +02:00
Simon Hausmann
6e5295c4d3
Fix project name guessing
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-11 08:50:57 +02:00
Simon Hausmann
cae7b732d8
Fix updating/creating remotes/p4/* heads from origin/p4/*
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-10 10:57:40 +02:00
Simon Hausmann
7aded26ce8
Fixed the check to make sure to exclude the HEAD symbolic refs when updating
...
the remotes/p4 branches from origin.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-10 00:22:30 +02:00
Han-Wen Nienhuys
5265bfcb06
also strip p4/ from local imports.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-06-08 19:31:49 -03:00
Han-Wen Nienhuys
69d8cc8b99
Merge branch 'master' of git://repo.or.cz/fast-export
2007-06-08 18:19:23 -03:00
Han-Wen Nienhuys
1b9a46849a
print error message when p4 print fails (eg. due to permission problems)
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-06-08 18:19:16 -03:00
Simon Hausmann
df450923a2
Only get the expensive branch mapping from the p4 server when not
...
syncing with the help of an origin remote (which we instead then use
to get new branches from).
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-08 08:49:22 +02:00
Simon Hausmann
a3fdd57901
Make git-p4 submit detect the correct reference (origin) branch when
...
working with multi-branch imports.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-07 22:54:32 +02:00
Simon Hausmann
5e100b5cd7
Make clone behave like git clone by default again.
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-07 21:52:12 +02:00
Marius Storm-Olsen
c4b33253c2
Exclude the HEAD symbolic ref from the list of known branches
...
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-07 15:28:04 +02:00
Marius Storm-Olsen
db775559c2
Fix single branch import into remotes
...
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-07 15:13:59 +02:00
Marius Storm-Olsen
98ad4faf95
Fix git-p4 clone (defaultDestination)
...
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
2007-06-07 15:08:33 +02:00
Marius Storm-Olsen
f7baba8b09
Ensure that the commit message is Windows formated (CRLF) before invoking the editor.
...
(The default editor on Windows (Notepad) doesn't handle Unix line endings)
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-06-07 14:11:15 +02:00
Simon Hausmann
a52d5c7bc0
Fix depot-path determination for git-p4 submit
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 13:10:20 +02:00
Simon Hausmann
b0d10df77a
Fix git-p4 submit
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 13:09:14 +02:00
Simon Hausmann
68c4215306
Fix git-p4 rebase
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 12:51:03 +02:00
Simon Hausmann
6509e19cd1
Hack to make the multi-branch import work again with self.depotPaths now that
...
self.depotPath is gone
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:41:53 +02:00
Simon Hausmann
330f53b8d6
Don't attempt to set the initialParent on multi-branch imports (useless).
...
At some point the code paths should be unified, but for now I need a working
git-p4 :)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:39:51 +02:00
Simon Hausmann
583e170706
Fix common path "calculation" from logs of multiple branches.
...
Need to use min instead of max for prev/cur to avoid out-of-bounds
string access. Also treat "i" as index of the last match instead of
a length because in case of a complete match of the two strings
i was off by one.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:37:13 +02:00
Simon Hausmann
845b42cb6c
Fix support for "depot-path" in older git-p4 imports
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:19:34 +02:00
Han-Wen Nienhuys
7530a40ce2
look for 'text' and 'binary' files.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-06-05 20:29:59 -03:00
Han-Wen Nienhuys
b1ce944726
thinko: really ignore deleted files.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 14:21:58 -03:00
Han-Wen Nienhuys
b17f88b544
remove debug print
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 12:40:24 -03:00
Han-Wen Nienhuys
86dff6b676
Cleanups & import into p4/master for local import
...
- import into master/local if --import-local is set
- use Die() for exiting
- if --verbose is set, raise Exception()
- use joined strings iso. `list` for progress printing
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 12:38:30 -03:00
Han-Wen Nienhuys
d2c6dd30ef
use p4CmdList() to get file contents in Python dicts. This is more robust.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-31 11:29:25 -03:00
Han-Wen Nienhuys
f2eda79f69
only run p4 print if necessary
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 18:50:41 -03:00
Han-Wen Nienhuys
982bb8a303
don't p4 print deleted files.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 17:33:18 -03:00
Han-Wen Nienhuys
96e07dd23c
read files before creating the commit.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:57:59 -03:00
Han-Wen Nienhuys
a3287be5bc
thinko.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:38:32 -03:00
Han-Wen Nienhuys
183b8ef89b
store p4 user cache in home directory.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:35:32 -03:00
Han-Wen Nienhuys
9320da8dd4
Thinko, fix buglet.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:22:57 -03:00
Han-Wen Nienhuys
6a49f8e2e0
Read p4 files in one batch.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 16:21:46 -03:00
Han-Wen Nienhuys
b86f73782e
remove global .gitdir
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 13:58:19 -03:00
Han-Wen Nienhuys
5e926eed9f
Merge origin.
2007-05-30 13:46:25 -03:00
Han-Wen Nienhuys
bb6e09b27a
Diverse cleanups
...
- print commands with \n
- extractDepotPathsAndChangeFromGitLog -> extractSettings, returning
dict.
- store keepRepoPath in [git-p4: ] line
- create a main() function, so git-p4 can be pychecked
- use --destination for clone destination. This simplifies logic
for --keep-path
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-30 13:44:15 -03:00
Simon Hausmann
cfeb59be25
Fix typo in listExistingP4Branches that broke sync.
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-28 19:24:57 +02:00
Simon Hausmann
9226c03c32
In *_pipe print the command that failed if it fails.
...
Fixed old calls to mypopen.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-28 19:23:19 +02:00
Han-Wen Nienhuys
6326aa5866
Extract multiple paths concurrently.
...
This enables importing just the interesting bits of large
repositories.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 12:50:04 -03:00
Han-Wen Nienhuys
4addad2291
add --verbose to all commands.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:45:26 -03:00
Han-Wen Nienhuys
b25b20656d
use strip() iso. slicing for removing \n
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:20:50 -03:00
Han-Wen Nienhuys
b76f0565bf
use string.strip() iso. slicing.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:19:10 -03:00
Han-Wen Nienhuys
8b41a97f8a
clone and sync --keep-path to keep perforce path to module.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:18:31 -03:00
Han-Wen Nienhuys
6754a299d8
minor cleanups
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:17:27 -03:00
Han-Wen Nienhuys
bce4c5fc0b
cleanup
...
- use re.sub() iso. if for stripping ...
- spacing nits
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:15:43 -03:00
Han-Wen Nienhuys
b016d39756
Robustness fixes for pipes
...
- add read_pipe(), read_pipe_lines(), write_pipe(), which
check pipe.close()
- use throughout
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 11:15:29 -03:00
Simon Hausmann
c8cbbee980
Fix my email address, this isn't really KDE related :)
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-28 14:43:25 +02:00
Han-Wen Nienhuys
7cb5cbefd2
rename apply() to applyCommit(); apply is a python builtin
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 14:29:11 +02:00
Han-Wen Nienhuys
cebdf5af31
reformatting: break long lines.
...
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 14:28:58 +02:00
Han-Wen Nienhuys
ce6f33c835
Cleanups
...
- don't use dir (python builtin)
- use re for munging depotPath into destination
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2007-05-28 14:22:53 +02:00
Simon Hausmann
a3c55c09ec
Fix creation of refs/remotes/p4/HEAD symbolic ref
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-27 15:48:01 +02:00
Simon Hausmann
cb4f1280dd
Added git-p4 submit --trust-me-like-a-fool for the adventurous users :)
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 22:34:30 +02:00
Simon Hausmann
877db584aa
Forgot to remove this TODO item when I made --with-origin the default :)
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 19:43:38 +02:00
Simon Hausmann
d414c74afd
Shortcut the case where we have no origin branch
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-25 11:36:42 +02:00
Simon Hausmann
01265103fe
Make --with-origin the default for syncing.
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-25 10:36:10 +02:00
Simon Hausmann
417a7a6fc8
Make --with-origin also work without origin :)
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-25 10:28:46 +02:00
Simon Hausmann
4280e53333
Make git-p4 work with packed refs (don't use os.path.exists to check for the
...
existance of a ref)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 08:49:18 +02:00
Simon Hausmann
65c5f3e3f2
Avoid creating non-p4 branches in remotes/p4 off of remotes/origin
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-25 08:44:41 +02:00
Simon Hausmann
10f880f8d4
Oops, fix --with-origin to /really/ also call git fetch :)
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 22:28:28 +02:00
Simon Hausmann
abcd790fe9
Added support for --with-origin with multi-branch imports
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 22:25:36 +02:00
Simon Hausmann
2cc58fd99a
Forgot to remove this return statement from debugging
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 22:10:40 +02:00
Simon Hausmann
d1874ed33b
Fix creating the remotes/p4 branches based on origin/* for the multi-branch import
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 21:23:04 +02:00
Marius Storm-Olsen
c1f9197f37
Replace \r\n with \n when importing from p4 on Windows
...
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-05-24 14:17:29 +02:00
Simon Hausmann
ebd8116870
Load the user map from p4 only once at run-time.
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-24 00:24:52 +02:00
Simon Hausmann
b3fd1b2808
Fix multi-branch import with --silent.
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:53:14 +02:00
Simon Hausmann
ad192f2888
Fix p4 execution in git-p4 rollback.
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:44:19 +02:00
Simon Hausmann
66a2f52395
Catch p4 errors in rollback early enough (before deleting refs!)
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:40:48 +02:00
Simon Hausmann
ac3e0d79ee
Oops, fill the /list/ correct with the p4 exit code.
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:32:32 +02:00
Simon Hausmann
a6d5da36af
Don't make len(p4Cmd("p4 changes -m 1 //foo/...")) == 0 succeed when the p4 command itself failed.
...
When the p4 command failed write out the exit code in the returned dict.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 23:29:01 +02:00
Simon Hausmann
0c66a78393
Make rollback work with locally imported branches
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 20:07:57 +02:00
Simon Hausmann
65d2ade95e
Avoid calling git symbolic-ref refs/heads/p4//HEAD (double slash)
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 16:41:46 +02:00
Simon Hausmann
a396b29267
Doc updates
...
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-23 00:33:34 +02:00
Simon Hausmann
57284050a8
Use refs/heads/* instead of refs/heads/p4/* for local imports
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 00:15:50 +02:00
Simon Hausmann
01a9c9c5a8
Added support for --max-changes=<count> to ease import debugging
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 00:07:35 +02:00
Simon Hausmann
a028a98e9a
Added support for importing multiple branches into refs/heads instead of just refs/remotes
...
using --import-local. Needs some further microfix but seems to work otherwise.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-23 00:03:08 +02:00
Simon Hausmann
52102d4784
Fixes for rollback, delete branches that did not exist at the specified p4 change
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 23:44:24 +02:00
Simon Hausmann
af8da89cb7
Fix branch detection in multi-branch imports
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 23:25:51 +02:00
Simon Hausmann
5834684d51
Added a rollback command for debugging. It sets back the heads of the p4 branches to the specified p4 change number or earlier.
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 22:57:06 +02:00
Simon Hausmann
7944f1425c
Make git-p4 submit --direct safer by also creating a git commit
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 11:04:26 +02:00
Simon Hausmann
cbf5efa61a
Detect with git-p4 submit --direct when there are no changes in the working directory
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 10:08:11 +02:00
Simon Hausmann
faf1bd2026
Fix git symbolic-ref warning on initial clone
...
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 10:05:30 +02:00