17 years agoAdded git-p4 branches command that shows the mapping of perforce depot paths to impor...
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>
Signed-off-by: Simon Hausmann <simon@lst.de>
Warn about conflicting p4 branch mappings and use the first one found.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
17 years agoFix the branch mapping detection to be independent from the order of the "p4 branches...
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>
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>
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>
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>
Fix initial multi-branch import.
The list of existing p4 branches in git wasn't initialized.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
The list of existing p4 branches in git wasn't initialized.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Only use double quotes on Windows
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
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>
always rebasing on top of remotes/p4/master
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
into a separate helper method.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
Noticed by Alex Riesen
Signed-off-by: Simon Hausmann <simon@lst.de>
Mention remotes/p4/master also in the documentation.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Provide some information for single branch imports where the commits go
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
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>
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>
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>
options
Signed-off-by: Simon Hausmann <simon@lst.de>
Fix support for explicit disabling of syncing with the origin
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Fix depot-paths encoding for multi-path imports (don't split up //depot/path/foo)
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Fix project name guessing
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Fix updating/creating remotes/p4/* heads from origin/p4/*
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
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>
the remotes/p4 branches from origin.
Signed-off-by: Simon Hausmann <simon@lst.de>
also strip p4/ from local imports.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Merge branch 'master' of git://repo.or.cz/fast-export
print error message when p4 print fails (eg. due to permission problems)
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
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>
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>
Make git-p4 submit detect the correct reference (origin) branch when
working with multi-branch imports.
Signed-off-by: Simon Hausmann <simon@lst.de>
working with multi-branch imports.
Signed-off-by: Simon Hausmann <simon@lst.de>
Make clone behave like git clone by default again.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Exclude the HEAD symbolic ref from the list of known branches
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Fix single branch import into remotes
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Fix git-p4 clone (defaultDestination)
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
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>
(The default editor on Windows (Notepad) doesn't handle Unix line endings)
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Fix depot-path determination for git-p4 submit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix git-p4 submit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix git-p4 rebase
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
self.depotPath is gone
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
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>
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>
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>
Fix support for "depot-path" in older git-p4 imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
look for 'text' and 'binary' files.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
thinko: really ignore deleted files.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
remove debug print
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
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>
- 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>
use p4CmdList() to get file contents in Python dicts. This is more robust.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
only run p4 print if necessary
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
don't p4 print deleted files.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
read files before creating the commit.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
thinko.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
store p4 user cache in home directory.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Thinko, fix buglet.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Read p4 files in one batch.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
remove global .gitdir
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Merge origin.
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>
- 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>
Fix typo in listExistingP4Branches that broke sync.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
In *_pipe print the command that failed if it fails.
Fixed old calls to mypopen.
Signed-off-by: Simon Hausmann <simon@lst.de>
Fixed old calls to mypopen.
Signed-off-by: Simon Hausmann <simon@lst.de>
Extract multiple paths concurrently.
This enables importing just the interesting bits of large
repositories.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
This enables importing just the interesting bits of large
repositories.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
add --verbose to all commands.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
use strip() iso. slicing for removing \n
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
use string.strip() iso. slicing.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
clone and sync --keep-path to keep perforce path to module.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
minor cleanups
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
cleanup
- use re.sub() iso. if for stripping ...
- spacing nits
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
- use re.sub() iso. if for stripping ...
- spacing nits
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
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>
- add read_pipe(), read_pipe_lines(), write_pipe(), which
check pipe.close()
- use throughout
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
add .dotest to .gitignore
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Fix my email address, this isn't really KDE related :)
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
rename apply() to applyCommit(); apply is a python builtin
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
reformatting: break long lines.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Cleanups
- don't use dir (python builtin)
- use re for munging depotPath into destination
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
- don't use dir (python builtin)
- use re for munging depotPath into destination
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Fix creation of refs/remotes/p4/HEAD symbolic ref
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Added git-p4 submit --trust-me-like-a-fool for the adventurous users :)
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Forgot to remove this TODO item when I made --with-origin the default :)
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Shortcut the case where we have no origin branch
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Make --with-origin the default for syncing.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Make --with-origin also work without origin :)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
existance of a ref)
Signed-off-by: Simon Hausmann <simon@lst.de>
Avoid creating non-p4 branches in remotes/p4 off of remotes/origin
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Oops, fix --with-origin to /really/ also call git fetch :)
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Added support for --with-origin with multi-branch imports
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Forgot to remove this return statement from debugging
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Fix creating the remotes/p4 branches based on origin/* for the multi-branch import
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Replace \r\n with \n when importing from p4 on Windows
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Load the user map from p4 only once at run-time.
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Fix multi-branch import with --silent.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix p4 execution in git-p4 rollback.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Catch p4 errors in rollback early enough (before deleting refs!)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Oops, fill the /list/ correct with the p4 exit code.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
When the p4 command failed write out the exit code in the returned dict.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Make rollback work with locally imported branches
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Avoid calling git symbolic-ref refs/heads/p4//HEAD (double slash)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Doc updates
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Use refs/heads/* instead of refs/heads/p4/* for local imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Added support for --max-changes=<count> to ease import debugging
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
using --import-local. Needs some further microfix but seems to work otherwise.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fixes for rollback, delete branches that did not exist at the specified p4 change
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix branch detection in multi-branch imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
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>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Make git-p4 submit --direct safer by also creating a git commit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Detect with git-p4 submit --direct when there are no changes in the working directory
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix git symbolic-ref warning on initial clone
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix error detection with git-p4 submit when the requested depot path is not in the client view.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Fix conversion from old style heads/p4 to remotes/p4/master
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>
Improved output for multi branch imports and noted another little todo item
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Another (potentially life-saving) idea for submit --direct
Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Simon Hausmann <simon@lst.de>