Commit Graph

448 Commits

Author SHA1 Message Date
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
Simon Hausmann
dc52403696 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>
2007-05-21 09:34:56 +02:00
Simon Hausmann
33be3e6550 Fix conversion from old style heads/p4 to remotes/p4/master
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-21 08:44:16 +02:00
Simon Hausmann
341dc1c179 Improved output for multi branch imports and noted another little todo item
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-21 00:39:16 +02:00
Simon Hausmann
b1561ee256 Another (potentially life-saving) idea for submit --direct
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 23:52:51 +02:00
Simon Hausmann
24f7b53fdd Had an idea for debugging, record it :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 23:42:22 +02:00
Simon Hausmann
8a5fc95b43 Specifying --detect-branches is now only needed for the initial clone/sync.
Afterwards it's turned on implicitly if more p4 branches than remotes/p4/master
are found.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-20 23:39:40 +02:00
Simon Hausmann
c1b296b9f1 Added support for git-p4 submit --direct (experimental)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 16:55:05 +02:00
Simon Hausmann
47a130b7bf Use git format-patch and git apply --apply when extracting patches from git and
applying them to a Perforce checkout. This should make it possible to apply git
commits with binary files that cannot be handled by path.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 16:33:21 +02:00
Simon Hausmann
64ffb06a9c Oops, not only /set/ gitdir on clone, also set it /correctly/ :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 15:24:01 +02:00
Simon Hausmann
59fa417109 Fix gitdir not being set when cloning. Needed for writing the p4 users cache.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 15:15:34 +02:00
Simon Hausmann
b607e71efd Cache the output of "p4 users" for faster syncs on high latency links.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-20 10:55:54 +02:00
Simon Hausmann
9bda3a8556 Removed unused variable, more cleanups
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 12:05:40 +02:00
Simon Hausmann
71b112d4a4 More cleanups and speedups for labels and branches
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 11:54:11 +02:00
Simon Hausmann
d5904674d1 Cleanup/speed up the branch<> file split and removed change range limitation that I added
for debugging (oops).

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 11:07:32 +02:00
Simon Hausmann
29bdbac1cd More work on the incremental importing of multiple branches.
Improved error detection by checking the exit code of git-fast-import.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-19 10:23:12 +02:00
Simon Hausmann
8f9b2e082b Give branches a nice project prefix and don't bail out on clone if we failed
to detect the master branch.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 22:13:26 +02:00
Simon Hausmann
4b97ffb1e4 Started rewriting the branch detection, based on "p4 branches" and "p4 branch -o foo".
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 21:45:23 +02:00
Simon Hausmann
66c6a9b559 Removed unused cache variables.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 20:39:38 +02:00
Simon Hausmann
05094f987c Fix branch setup after initial clone.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-18 20:32:35 +02:00
Simon Hausmann
71bd9bacec Removed todo item that is implemented :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 22:22:26 +02:00
Simon Hausmann
ef48f9093c Added support for git-p4 sync/rebase --with-origin. See git-p4.txt for details :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 22:17:49 +02:00
Simon Hausmann
48df6fd850 Bite the bullet and automatically convert old style refs/heads/p4 repositories
to the new style refs/remotes/p4 branching.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 21:18:53 +02:00
Simon Hausmann
c6d44cb1a1 Changed the default p4 import branch to be refs/remotes/p4/{HEAD,master}
instead of refs/heads/p4.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 20:57:05 +02:00
Simon Hausmann
8ead4fda3f Create the origin based import branch using git update-ref instead of git branch
so that it's possible to have the import branch in refs/remotes.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 20:26:58 +02:00
Simon Hausmann
1c9d393d30 Removed ancient and unused code to find the last imported revision from previous imports
to use for the current import by looking at the p4 tags. The current approach of using
the log message works better.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 20:15:47 +02:00
Simon Hausmann
8a2820def4 Removed cleantags command. It doesn't have any meaning anymore.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 19:44:50 +02:00
Simon Hausmann
463e8af655 Clean up code duplication for revision parsing and fix previous commit to not
import into remotes/p4 (yet!).

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 09:13:54 +02:00
Simon Hausmann
f9162f6a4c Always pass a sha1 for the initial parent so that git-fast-import doesn't think
it's creating a new branch from itself. It's a sensible error in general but
in the case of incremental imports we have to apply force :)

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 09:09:05 +02:00
Simon Hausmann
5c4153e488 Fixing syncing (gitdir discovery / cd) for bare repositories
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-17 07:42:38 +02:00
Junio C Hamano
fdcb769916 Merge branch 'maint'
* maint:
  format-patch: add MIME-Version header when we add content-type.
  Fixed link in user-manual
  import-tars: Use the "Link indicator" to identify directories
  git name-rev writes beyond the end of malloc() with large generations
  Documentation/branch: fix small typo in -D example
2007-05-16 12:43:05 -07:00
Johannes Schindelin
df8cfac815 import-tars: Use the "Link indicator" to identify directories
Earlier, we used the mode to determine if a name was associated with
a directory. This fails, since some tar programs do not set the mode
correctly. However, the link indicator _has_ to be set correctly.

Noticed by Chris Riddoch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-16 14:54:22 -04:00
Simon Hausmann
ca0affe7bb A little todo note before I forget it :), based on a suggestion from Lars.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 13:15:34 +02:00
Simon Hausmann
dc1a93b6dc Fix calling git-p4 rebase from within a subdirectory (git rebase wants to be in toplevel)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 12:12:39 +02:00
Simon Hausmann
c3c4624451 Give a better hint if git-p4 submit fails
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 09:43:13 +02:00
Simon Hausmann
d336c15835 Added the possibility of skipping patches during git-p4 submit
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-16 09:41:46 +02:00
Simon Hausmann
81f2373f89 Make git-p4 work with bare repositories.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-15 23:06:43 +02:00
Simon Hausmann
cd6cc0d318 Fix git-p4 clone //depot/project (head import)
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-15 16:15:26 +02:00
Marius Storm-Olsen
95962f318e Make the command call silent
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-05-15 16:07:41 +02:00
Simon Hausmann
42890f6291 Converted to unix newlines
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-05-15 16:07:02 +02:00
Simon Hausmann
25df95cce4 Make submitting work on Windows.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 15:15:07 +02:00
Simon Hausmann
caace11112 Make sure all popen calls use binary mode (for Windows) and
also make gitBranchExists work on Windows.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 15:15:07 +02:00
Simon Hausmann
ac1fde55a7 Added a little .bat wrapper from Marius
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 14:44:32 +02:00
Simon Hausmann
0848358055 Use the subprocess module instead of popen2 to make it work on Windows.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-05-15 14:27:56 +02:00
Junio C Hamano
ffcc952b33 Merge branch 'maint'
* maint:
  Fix documentation of tag in git-fast-import.txt
  Properly handle '0' filenames in import-tars
2007-05-10 14:48:04 -07:00
Shawn O. Pearce
d966e6aa66 Properly handle '0' filenames in import-tars
Randal L. Schwartz pointed out multiple times that we should be
testing the length of the name string here, not if it is "true".
The problem is the string '0' is actually false in Perl when we
try to evaluate it in this context, as '0' is 0 numerically and
the number 0 is treated as a false value.  This would cause us
to break out of the import loop early if anyone had a file or
directory named "0".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-07 21:13:40 -04:00
Simon Hausmann
a844b7406f Document some implementation details, for the curious... :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-07 20:14:17 +02:00
Shawn O. Pearce
db81e67a7d Merge branch 'gfi-maint' into gfi-master
* gfi-maint:
  Teach import-tars about GNU tar's @LongLink extension.
2007-05-02 13:24:10 -04:00
Johannes Schindelin
775477aa1d Teach import-tars about GNU tar's @LongLink extension.
This extension allows GNU tar to process file names in excess of the 100
characters defined by the original tar standard. It does this by faking a
file, named '././@LongLink' containing the true file name, and then adding
the file with a truncated name. The idea is that tar without this
extension will write out a file with the long file name, and write the
contents into a file with truncated name.

Unfortunately, GNU tar does a lousy job at times. When truncating results
in a _directory_ name, it will happily use _that_ as a truncated name for
the file.

An example where this actually happens is gcc-4.1.2, where the full path
of the file WeThrowThisExceptionHelper.java truncates _exactly_ before the
basename. So, we have to support that ad-hoc extension.

This bug was noticed by Chris Riddoch on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-02 13:22:34 -04:00
Simon Hausmann
2835925139 Cleanup, removed the old tagging code
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 23:26:19 +02:00
Simon Hausmann
8f8725314d cleanup, renamed self.globalPrefix to self.depotPath
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 23:23:00 +02:00
Simon Hausmann
1c094184da Micro cleanup
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 23:15:48 +02:00
Simon Hausmann
ff5dba20e3 Doc cleanups.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-05-01 18:28:38 +02:00
Junio C Hamano
39231b1c32 Merge branch 'maint'
* maint:
  http.c: Fix problem with repeated calls of http_init
  Add missing reference to GIT_COMMITTER_DATE in git-commit-tree documentation
  Fix import-tars fix.
  Update .mailmap with "Michael"
  Do not barf on too long action description
  Catch empty pathnames in trees during fsck
  Don't allow empty pathnames in fast-import
  import-tars: be nice to wrong directory modes
  git-svn: Added 'find-rev' command
  git shortlog documentation: add long options and fix a typo
2007-04-29 01:52:43 -07:00
Junio C Hamano
d0c32b6339 Fix import-tars fix.
This heeds advice from our resident Perl expert to make sure
the script is not confused with a string that ends with /\n

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-29 01:34:59 -07:00
Johannes Schindelin
87859f3443 import-tars: be nice to wrong directory modes
Some tars seem to have modes 0755 for directories, not 01000755. Do
not generate an empty object for them, but ignore them.

Noticed by riddochc on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-04-28 20:01:36 -04:00
Uwe Kleine-König
46f6178a3f fix importing of subversion tars
add a / between the prefix and name fields of the tar archive if prefix
is non-empty.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-04-24 12:14:40 -04:00
Simon Hausmann
51a2640afd Handle patch errors in git-p4 submit better.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-15 09:59:56 +02:00
Simon Hausmann
90865adc01 A new attempt at fixing the child-fast-import-process-not-finished race condition
in the clone command

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-15 09:34:15 +02:00
Simon Hausmann
5e80dd4d7e Slightly improved formatting of the raw_input questions.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-14 16:09:43 +02:00
Simon Hausmann
8b72ca0f76 Removed the old patch apply code from git-p4 submit.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-14 16:05:54 +02:00
Simon Hausmann
f291b4e3d4 Fix the timezone formatting. Now qgit also displays (parses) it correctly.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-14 11:21:50 +02:00
Simon Hausmann
fd4ca86a0b Print an error message of some sort if git fast-import fails.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-13 22:21:10 +02:00
Simon Hausmann
80b5910fac Allow for convenient rebasing after git-p4 submit
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-09 12:43:40 +02:00
Simon Hausmann
7243b350b3 Added a simple example of usage to the "documentation" :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:21:56 +02:00
Simon Hausmann
10c3211b81 fix variable usage (oops)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:15:47 +02:00
Simon Hausmann
c45b1cfe1e Fix file determination for #head imports
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:13:32 +02:00
Simon Hausmann
f9a3a4f796 Added git-p4 clone convenience command
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 10:08:26 +02:00
Simon Hausmann
68ed351ab5 Honor --silent for labels
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 09:00:55 +02:00
Simon Hausmann
cb53e1f8e9 Turn off potentially slow label detection by default
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 00:12:02 +02:00
Simon Hausmann
1f52af6c73 Provide a tree summary after git-p4 rebase
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-08 00:07:02 +02:00
Simon Hausmann
01ce1fe967 Added git-p4 rebase convenience
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-04-07 23:46:50 +02:00
Simon Hausmann
711544b00c Clean up python class names.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-04-01 15:40:46 +02:00
Simon Hausmann
2a9489c024 Fix "compilation" :)
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-04-01 13:39:39 +02:00
Simon Hausmann
c9b50e6307 Fix the docs for git-p4 submit and turn git-p4 submit --master=foo into
simply git-p4 submit mytopicbranch.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-29 19:15:24 +02:00
Simon Hausmann
a46668faf7 Fix variable usage in tag import
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-28 17:05:38 +02:00
Simon Hausmann
1f4ba1cbfc Added support for mapping p4 labels to git tags
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-26 22:34:34 +02:00
Simon Hausmann
8910ac0e88 git-p4 debug doesn't need a git repository
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-26 08:18:55 +02:00
Simon Hausmann
e20a9e530a Don't try to parse any options with git-p4 debug but pass it straight on to p4
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-26 00:13:51 +02:00
Simon Hausmann
9863f4055e Prefer git command over git-command.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-24 16:35:05 +01:00
Simon Hausmann
274917a3d6 Minor cosmetic fixlet for the git-p4 submit sync question.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-24 09:18:20 +01:00
Simon Hausmann
cb2c9db507 Different versions of p4 have different output for the where command ;(
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-24 09:15:11 +01:00
Simon Hausmann
967f72e21b Use the new incremental import style by default
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-03-23 09:30:41 +01:00
Simon Hausmann
9512497bcf Make it possible to run git-p4 submit from within the git repository
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-23 09:16:07 +01:00
Simon Hausmann
179caebff4 Brand new smart incremental import that doesn't need tags or git repo-config :)
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 22:17:42 +01:00
Simon Hausmann
569d1bd409 Set the default branch in run, not in the constructor
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 21:34:16 +01:00
Simon Hausmann
8136a6399c Helper function to check the existance of a revision
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 21:27:14 +01:00
Simon Hausmann
6ae8de88f5 Added some helper function(s) to parse the depot path and change number from the log message
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 21:10:25 +01:00
Simon Hausmann
f5816a5522 Changed the default branch for imports from "master" to "p4"
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 20:36:28 +01:00
Simon Hausmann
a559b289bd Changed the format of the imported log message slightly, so that it's easier to parse again.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-22 20:27:41 +01:00
Simon Hausmann
e7f0d0d9b9 Removed the .py extension from git-p4 as it's annoying to type every time.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-22 09:15:32 +01:00
Simon Hausmann
53150250b1 Don't show the submit template and the diff first in less but show it in $editor right away
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-21 21:04:12 +01:00
Simon Hausmann
2061865005 Make it possible to invoke git-p4 from within subdirectories of a git working tree.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 13:05:30 +01:00
Simon Hausmann
1932a6ac7c Made --apply-as-patch the default for git-p4 submit as it's significantly faster.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 11:01:18 +01:00
Simon Hausmann
5d0b6042d4 Fix support for deletions in git-p4 submit when using --apply-as-patch by filtering out deletions in the diff-tree output.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 10:57:54 +01:00
Simon Hausmann
04219c04b7 Added experimental but super-fast --apply-as-patch option to git-p4 submit
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-21 10:11:20 +01:00
Simon Hausmann
b4aa8d12b4 Documentation enhancements.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-21 08:27:33 +01:00
Simon Hausmann
0b69b46925 Start of the git-p4 documentation.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-20 22:41:00 +01:00
Simon Hausmann
c5fdcbcc20 Removed p4-fast-export and p4-git-sync as they've been integrated into git-p4 now.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-20 22:09:27 +01:00
Simon Hausmann
c715706b15 Fixed the initial version import by getting the file index correct by correctly skipping deleted files.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-20 21:13:49 +01:00
Simon Hausmann
0828ab1403 Added missing "self"s to make the script evaluate correctly.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-20 20:59:30 +01:00
Simon Hausmann
b984733c80 Completely untested "merge" of p4-fast-export.py into git-p4.py
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-20 20:54:23 +01:00
Simon Hausmann
05140f342e sync-to-perforce is now called submit and fixed the gitdir check a little bit
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-20 18:32:47 +01:00
Simon Hausmann
83dce55af3 Part of the code is copyright by Trolltech ASA.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-19 22:26:36 +01:00
Simon Hausmann
4f5cf76a55 First (untested) attempt at migrating p4-git-sync into the final git-p4 script
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-19 22:25:17 +01:00
Simon Hausmann
c8c3911685 Provide a little bit of help description for the git-p4 "tools".
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-19 21:02:30 +01:00
Simon Hausmann
86949eef40 Start moving the git-p4 tools into one single script.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-19 20:59:12 +01:00
Simon Hausmann
95d27cb75d Pass the right number of arguments to commit, fixes single-branch imports.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-19 12:04:37 +01:00
Simon Hausmann
09e16455e0 Improved the git dir detection.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-19 11:57:10 +01:00
Simon Hausmann
228d36c92b Default to interactive syncing
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-16 13:47:46 +01:00
Simon Hausmann
f72537f97e Use p4 revert ... instead of revert -a ... after submitting, to make sure the p4 checkout is clean.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-15 19:07:06 +01:00
Simon Hausmann
d566209e7f Auto-detect the current git branch before submitting back to perforce.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-14 23:30:23 +01:00
Simon Hausmann
4d9e5fcea6 Ignore Apple resource files when importing from perforce to git.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-14 19:03:16 +01:00
Simon Hausmann
d7873afdf4 Be nice and use /usr/bin/env python for the git-p4 scripts
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-14 17:33:46 +01:00
Simon Hausmann
794a913a00 Automatically operate on a temporary branch, needed for cherry-pick to work when applying changes to
files that are deleted in the future.
Also do some Perforce cleaning

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-14 17:31:47 +01:00
Simon Hausmann
09a14fb524 Lots of bugfixes to p4-git-sync.
Added interactive and dry-run mode.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-13 16:36:10 +01:00
Simon Hausmann
5aba82fd50 Fix git-dir option and allow reading log substitutions from a file
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-13 09:14:45 +01:00
Simon Hausmann
0bcff6121d First version of a new script to submit changes back to perforce from git repositories.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-12 23:00:34 +01:00
Simon Hausmann
4fe2ca17f7 Split up the cache commandline options into (command) cache and data cache.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-10 21:30:24 +01:00
Simon Hausmann
dd87020bd3 Reduce the number of false "merges" by skipping "branch from" entries in the integrated output as well as by ignoring integrations of future (newer) changes.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-10 21:23:49 +01:00
Simon Hausmann
43cc31e8a2 More work on branch detection by implementing changeIsBranchMerge().
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-10 17:46:49 +01:00
Simon Hausmann
85a8f1ac3b More code cleanups and preparations for more branch detection heuristics.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-10 11:46:26 +01:00
Simon Hausmann
478764bc82 Minor code cleanups.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-10 10:53:07 +01:00
Simon Hausmann
59f1d2b52d Make the p4 data/command cache configurable through the --cache-debug commandline option.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-10 10:25:34 +01:00
Simon Hausmann
a0f22e996c Fixed p4-debug file extension.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-03-10 09:49:19 +01:00
Simon Hausmann
934371385c Changed --known-branches to take a file as argument instead of a comma separated list.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-08 21:34:40 +01:00
Simon Hausmann
3ef674bd4b Work in progress on detecting branches.
Added a disk-cache p4 output so debugging imports is faster.
Added --known-branches commandline option for pre-defining branches.
Various other fixes...

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-08 21:27:59 +01:00
Simon Hausmann
6392a40e5e Adjust the output parsing of git name-rev to handle the output of the latest git version.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-03-07 19:58:54 +01:00
Simon Hausmann
5ea919de22 Don't print a plain newline at the end of the execution (avoids bogus cron error mails).
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-02-22 10:20:53 +01:00
Simon Hausmann
47e33ec082 More work in --silent support.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-22 09:22:36 +01:00
Simon Hausmann
161958cc2f Added support for --silent so that p4-fast-export can be called from cronjobs.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-22 09:03:39 +01:00
Simon Hausmann
9c9fec3d28 Added p4 delete behavioural emulation as todo item.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-21 17:51:07 +01:00
Michael Loeffler
c750da256a Use gunzip -c over gzcat in import-tars example.
Not everyone has gzcat or bzcat installed on their system, but
gunzip -c and bunzip2 -c perform the same task and are available
if the user has installed gzip support or bzip2 support.

Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 11:09:57 -05:00
Simon Hausmann
90dc3dfdc8 Fix single-branch imports by skipping the branch/merge detection correctly.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-18 01:18:22 +10:00
Simon Hausmann
f1e9b5345e Use sets.Set() instead of set() to run also with older versions of Python.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-15 02:16:14 +10:00
Simon Hausmann
0563a4538a Make it possible to specify the p4 changes to import through a text file (for debugging) and made various improvements to the branch/merge heuristic detection.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-14 17:13:17 +01:00
Simon Hausmann
930d3cc94e When trying to map p4 integrations to git merges just record it as a single merge with the newest p4 change as secondary parent.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-12 22:05:21 +01:00
Simon Hausmann
77083daac7 Set git fast-import marks for every imported change for future use.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-12 21:56:46 +01:00
Simon Hausmann
53b03239aa After marking a p4 branch as merged don't ever merge it in git again.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-12 21:44:02 +01:00
Simon Hausmann
dcacf8b447 More fixes in heuristic p4 branch detection based on common path components.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-12 21:41:45 +01:00
Simon Hausmann
766887e110 Started work on p4 branch detection (experimental!).
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-12 21:04:59 +01:00
Simon Hausmann
44b3add651 Code cleanups.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-12 20:28:58 +01:00
Michael Loeffler
d63ea11594 import-tars: brown paper bag fix for file mode.
There is a bug with this $git_mode variable which should be 0644
or 0755, but nothing else I think.

Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-12 12:19:45 -05:00
Simon Hausmann
12d04ca7da Cleanups, remove unused variable.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-11 21:35:34 +01:00
Simon Hausmann
fc21f8a1da Create lightweight git tags (using the "reset" trick) for the incremental import instead of full-blown ones. Also fix parsing the output of git name-rev for figuring out the last imported p4 change number.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-11 18:04:39 +01:00
Simon Hausmann
f7d63b0c99 Added a little helper script to remove unused tags from the perforce import.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-02-10 10:26:03 +01:00
Simon Hausmann
fe2193183a Changed the default git import branch from "p4" to "master".
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-10 10:05:51 +01:00
Simon Hausmann
8718f3ec9a Avoid the excessive use of git tags for every perforce change and instead just create one git tag for the last imported change.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-10 10:05:29 +01:00
Simon Hausmann
b41507a427 Minor code cleanups.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-10 09:25:22 +01:00
Simon Hausmann
20c7bc76b9 Added a little helper script to debug the output of the p4 python interface.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-02-08 23:00:19 +01:00
Shawn O. Pearce
590dd4bfd2 tar archive frontend for fast-import.
This is an example fast-import frontend, in less than 100 lines
of Perl.  It accepts one or more tar archives on the command line,
passes them through gzcat/bzcat/zcat if necessary, parses out the
individual file headers and feeds all contained data to fast-import.
No temporary files are involved.

Each tar is treated as one commit, with the commit timestamp coming
from the oldest file modification date found within the tar.

Each tar is also tagged with an annotated tag, using the basename
of the tar file as the name of the tag.

Currently symbolic links and hard links are not handled by the
importer.  The file checksums are also not verified.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-08 15:37:53 -05:00
Simon Hausmann
c9c527d7b6 Made the name of the git branch used for the perforce import configurable through a new --branch=<name> commandline option.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-08 15:53:11 +01:00
Simon Hausmann
7315866824 Catch io exceptions from git fast-import again and print the error message.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-08 15:45:16 +01:00
Simon Hausmann
1e30c07dfc Fix calculation of the newest imported revision for #head imports.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-07 23:51:51 +01:00
Simon Hausmann
23efd2545b Make specifying the revision ranges more convenient.
Added support for @all as revision range specifier to import all changes to a given depot path.
Also default to an import of #head if no revrange is specified.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-07 23:37:54 +01:00
Simon Hausmann
1cd573866a Make incremental imports easier to use by storing the p4 depot path after an import in .git/config and re-using it when we're invoked again later.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-07 23:25:56 +01:00
Simon Hausmann
e3d37cf098 Fixed incremental imports by using the correct "from" command instead of "merge" with git fast-import.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-07 23:09:49 +01:00
Simon Hausmann
c4cf2d4f87 Minor cleanups and print an error message of git fast-import if it fails.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-07 22:57:01 +01:00
Simon Hausmann
6d48d12f5d Initial support for importing a directory from Perforce at a specified revision.
Use p4 files //depot/path/...@revision to determine the state of the project and create a "fake" git commit from it.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-01 18:19:55 +01:00
Simon Hausmann
68f1336fe3 Code cleanups, move the code to create a commit with fast-import into a separate function out of the main loop.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-01 17:42:23 +01:00
Simon Hausmann
f16255f559 Simplify the incremental import by elimination the need for a temporary import branch.
It turns out that git fast-import can "resume" from an existing branch just fine.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-01 08:23:39 +01:00
Simon Hausmann
61b3cf7c47 Started working on incremental imports from Perforce.
Try to find the last imported p4 change number from the git tags and try to pass the right parent for commits to git fast-import.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-02-01 00:08:51 +01:00
Simon Hausmann
79799d52b2 Fix file permissions of p4-fast-export.py to be executable.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 23:09:24 +01:00
Simon Hausmann
71f7c0d0bb Create a git tag for every changeset imported from perforce.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 23:03:01 +01:00
Simon Hausmann
214bed8239 Fixed displaying import progress by calling flush on stdout.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 22:47:53 +01:00
Simon Hausmann
f26037dce3 Permit calling p4-fast-export with a depot path that has the typical ... wildcard at the end.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 22:41:08 +01:00
Simon Hausmann
2385536282 Avoid calling fstat for every imported file (slow!) and instead read the file data first into the python process and use the length of the bytes read for the size field of git fast-import.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 22:38:07 +01:00
Simon Hausmann
0dd0b9d011 Ported the remaining functions that parsed p4 shell output over to the p4 python interface.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 22:31:28 +01:00
Simon Hausmann
a39811b46e Instead of parsing the output of "p4 users" use the python objects of "p4 -G users".
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 22:19:18 +01:00
Simon Hausmann
f6148d9129 Minor code cleanups and ported some p4 interfacing code over to the p4 python mode.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 22:13:17 +01:00
Simon Hausmann
701ce87633 Changed the import mechanism to write to git fast-import through a pipe instead of having p4-fast-export write to stdout and let the caller connect it to git fast-import.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 21:54:56 +01:00
Simon Hausmann
3f2ddd47c7 Removed unused p4cat function and added helper function for the perforce python interface (p4Cmd).
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 20:48:39 +01:00
Simon Hausmann
9466d479e2 Speed up the import of individual files from Perforce into git by passing the output of "p4 print" directly to git fast-import. Also try to set the mode of the file in git correctly based on file type heuristics.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 20:16:26 +01:00
Simon Hausmann
d93ed31ac4 Some fixes to the timezone conversion between the date of a perforce change and the git commit.
Signed-off-by: Simon Hausmann <hausmann@kde.org>
2007-01-31 19:43:16 +01:00
Simon Hausmann
72b2f0ada3 Implemented basic support for converting the date of the perforce change to the git format. The timezone isn't correctly set up yet though.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-01-31 16:39:46 +01:00
Simon Hausmann
06bb04454f Slightly improved help usage output and made specifying the trailing slash for the depot path optional.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-01-31 09:49:41 +01:00
Simon Hausmann
da96cd9e24 Added basic support for specifying the depot path to import from as well as the range of perforce changes.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-01-31 09:39:20 +01:00
Simon Hausmann
16d6b8ab6f Initial import of a python script to import changesets from Perforce into git.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-01-31 00:16:59 +01:00