Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
8b41a97f
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8b41a97f
编写于
5月 23, 2007
作者:
H
Han-Wen Nienhuys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clone and sync --keep-path to keep perforce path to module.
Signed-off-by:
N
Han-Wen Nienhuys
<
hanwen@google.com
>
上级
6754a299
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
9 deletion
+12
-9
contrib/fast-import/git-p4
contrib/fast-import/git-p4
+12
-9
未找到文件。
contrib/fast-import/git-p4
浏览文件 @
8b41a97f
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
import
optparse
,
sys
,
os
,
marshal
,
popen2
,
subprocess
,
shelve
import
optparse
,
sys
,
os
,
marshal
,
popen2
,
subprocess
,
shelve
import
tempfile
,
getopt
,
sha
,
os
.
path
,
time
,
platform
import
tempfile
,
getopt
,
sha
,
os
.
path
,
time
,
platform
import
re
import
re
from
sets
import
Set
;
from
sets
import
Set
;
gitdir
=
os
.
environ
.
get
(
"GIT_DIR"
,
""
)
gitdir
=
os
.
environ
.
get
(
"GIT_DIR"
,
""
)
...
@@ -20,7 +21,6 @@ def write_pipe(c, str):
...
@@ -20,7 +21,6 @@ def write_pipe(c, str):
if
not
silent
:
if
not
silent
:
sys
.
stderr
.
write
(
'writing pipe: %s
\n
'
%
c
)
sys
.
stderr
.
write
(
'writing pipe: %s
\n
'
%
c
)
## todo: check return status
pipe
=
os
.
popen
(
c
,
'w'
)
pipe
=
os
.
popen
(
c
,
'w'
)
val
=
pipe
.
write
(
str
)
val
=
pipe
.
write
(
str
)
if
pipe
.
close
():
if
pipe
.
close
():
...
@@ -32,7 +32,7 @@ def write_pipe(c, str):
...
@@ -32,7 +32,7 @@ def write_pipe(c, str):
def
read_pipe
(
c
):
def
read_pipe
(
c
):
if
not
silent
:
if
not
silent
:
sys
.
stderr
.
write
(
'reading pipe: %s
\n
'
%
c
)
sys
.
stderr
.
write
(
'reading pipe: %s
\n
'
%
c
)
## todo: check return status
pipe
=
os
.
popen
(
c
,
'rb'
)
pipe
=
os
.
popen
(
c
,
'rb'
)
val
=
pipe
.
read
()
val
=
pipe
.
read
()
if
pipe
.
close
():
if
pipe
.
close
():
...
@@ -60,8 +60,6 @@ def system(cmd):
...
@@ -60,8 +60,6 @@ def system(cmd):
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
die
(
"command failed: %s"
%
cmd
)
die
(
"command failed: %s"
%
cmd
)
def
p4CmdList
(
cmd
):
def
p4CmdList
(
cmd
):
cmd
=
"p4 -G %s"
%
cmd
cmd
=
"p4 -G %s"
%
cmd
pipe
=
os
.
popen
(
cmd
,
"rb"
)
pipe
=
os
.
popen
(
cmd
,
"rb"
)
...
@@ -566,7 +564,8 @@ class P4Sync(Command):
...
@@ -566,7 +564,8 @@ class P4Sync(Command):
optparse
.
make_option
(
"--detect-labels"
,
dest
=
"detectLabels"
,
action
=
"store_true"
),
optparse
.
make_option
(
"--detect-labels"
,
dest
=
"detectLabels"
,
action
=
"store_true"
),
optparse
.
make_option
(
"--verbose"
,
dest
=
"verbose"
,
action
=
"store_true"
),
optparse
.
make_option
(
"--verbose"
,
dest
=
"verbose"
,
action
=
"store_true"
),
optparse
.
make_option
(
"--import-local"
,
dest
=
"importIntoRemotes"
,
action
=
"store_false"
),
optparse
.
make_option
(
"--import-local"
,
dest
=
"importIntoRemotes"
,
action
=
"store_false"
),
optparse
.
make_option
(
"--max-changes"
,
dest
=
"maxChanges"
)
optparse
.
make_option
(
"--max-changes"
,
dest
=
"maxChanges"
),
optparse
.
make_option
(
"--keep-path"
,
dest
=
"keepRepoPath"
)
]
]
self
.
description
=
"""Imports from Perforce into a git repository.
\n
self
.
description
=
"""Imports from Perforce into a git repository.
\n
example:
example:
...
@@ -590,6 +589,7 @@ class P4Sync(Command):
...
@@ -590,6 +589,7 @@ class P4Sync(Command):
self
.
maxChanges
=
""
self
.
maxChanges
=
""
self
.
isWindows
=
(
platform
.
system
()
==
"Windows"
)
self
.
isWindows
=
(
platform
.
system
()
==
"Windows"
)
self
.
depotPath
=
None
self
.
depotPath
=
None
self
.
keepRepoPath
=
False
if
gitConfig
(
"git-p4.syncFromOrigin"
)
==
"false"
:
if
gitConfig
(
"git-p4.syncFromOrigin"
)
==
"false"
:
self
.
syncWithOrigin
=
False
self
.
syncWithOrigin
=
False
...
@@ -617,8 +617,11 @@ class P4Sync(Command):
...
@@ -617,8 +617,11 @@ class P4Sync(Command):
fnum
=
fnum
+
1
fnum
=
fnum
+
1
return
files
return
files
def
stripRepoPath
(
self
,
path
):
def
stripRepoPath
(
self
,
path
,
prefix
):
return
path
[
len
(
self
.
depotPath
):]
if
self
.
keepRepoPath
:
prefix
=
re
.
sub
(
"^(//[^/]+/).*"
,
r
'\1'
,
prefix
)
return
path
[
len
(
prefix
):]
def
splitFilesIntoBranches
(
self
,
commit
):
def
splitFilesIntoBranches
(
self
,
commit
):
branches
=
{}
branches
=
{}
...
@@ -638,7 +641,7 @@ class P4Sync(Command):
...
@@ -638,7 +641,7 @@ class P4Sync(Command):
file
[
"type"
]
=
commit
[
"type%s"
%
fnum
]
file
[
"type"
]
=
commit
[
"type%s"
%
fnum
]
fnum
=
fnum
+
1
fnum
=
fnum
+
1
relPath
=
self
.
stripRepoPath
(
path
)
relPath
=
self
.
stripRepoPath
(
path
,
self
.
depotPath
)
for
branch
in
self
.
knownBranches
.
keys
():
for
branch
in
self
.
knownBranches
.
keys
():
...
@@ -687,7 +690,7 @@ class P4Sync(Command):
...
@@ -687,7 +690,7 @@ class P4Sync(Command):
continue
continue
rev
=
file
[
"rev"
]
rev
=
file
[
"rev"
]
depotPath
=
path
+
"#"
+
rev
depotPath
=
path
+
"#"
+
rev
relPath
=
path
[
len
(
branchPrefix
):]
relPath
=
self
.
stripRepoPath
(
path
,
branchPrefix
)
action
=
file
[
"action"
]
action
=
file
[
"action"
]
if
file
[
"type"
]
==
"apple"
:
if
file
[
"type"
]
==
"apple"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录