Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
git-repo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux-tools
git-repo
Commits
66be4f8a
Commit
66be4f8a
authored
Mar 08, 2013
by
Matthias Putz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrated to py33, init works so far (bug in links)
parent
2acbeb81
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
123 additions
and
171 deletions
+123
-171
git_command.py
git_command.py
+3
-3
git_config.py
git_config.py
+7
-7
git_refs.py
git_refs.py
+4
-4
main.py
main.py
+11
-0
manifest_xml.py
manifest_xml.py
+20
-19
project.py
project.py
+12
-12
__init__.py
subcmds/__init__.py
+2
-2
branches.py
subcmds/branches.py
+1
-1
cherry_pick.py
subcmds/cherry_pick.py
+1
-1
forall.py
subcmds/forall.py
+42
-42
grep.py
subcmds/grep.py
+1
-1
selfupdate.py
subcmds/selfupdate.py
+0
-62
status.py
subcmds/status.py
+7
-7
sync.py
subcmds/sync.py
+12
-10
No files found.
git_command.py
View file @
66be4f8a
...
...
@@ -79,7 +79,7 @@ class _GitCall(object):
def
version
(
self
):
p
=
GitCommand
(
None
,
[
'--version'
],
capture_stdout
=
True
)
if
p
.
Wait
()
==
0
:
return
p
.
stdout
return
str
(
p
.
stdout
,
encoding
=
'UTF-8'
)
return
None
def
version_tuple
(
self
):
...
...
@@ -117,7 +117,7 @@ def git_require(min_version, fail=False):
return
False
def
_setenv
(
env
,
name
,
value
):
env
[
name
]
=
value
.
encode
()
env
[
name
]
=
value
.
encode
(
encoding
=
'UTF-8'
)
class
GitCommand
(
object
):
def
__init__
(
self
,
...
...
@@ -164,7 +164,7 @@ class GitCommand(object):
command
=
[
GIT
]
if
bare
:
if
gitdir
:
_setenv
(
env
,
GIT_DIR
,
gitdir
)
env
[
GIT_DIR
]
=
gitdir
cwd
=
None
command
.
extend
(
cmdv
)
...
...
git_config.py
View file @
66be4f8a
...
...
@@ -14,7 +14,7 @@
# limitations under the License.
from
__future__
import
print_function
import
cP
ickle
import
p
ickle
import
os
import
re
import
subprocess
...
...
@@ -262,7 +262,7 @@ class GitConfig(object):
Trace
(
': unpickle
%
s'
,
self
.
file
)
fd
=
open
(
self
.
_pickle
,
'rb'
)
try
:
return
cP
ickle
.
load
(
fd
)
return
p
ickle
.
load
(
fd
)
finally
:
fd
.
close
()
except
EOFError
:
...
...
@@ -271,7 +271,7 @@ class GitConfig(object):
except
IOError
:
os
.
remove
(
self
.
_pickle
)
return
None
except
cP
ickle
.
PickleError
:
except
p
ickle
.
PickleError
:
os
.
remove
(
self
.
_pickle
)
return
None
...
...
@@ -279,13 +279,13 @@ class GitConfig(object):
try
:
fd
=
open
(
self
.
_pickle
,
'wb'
)
try
:
cPickle
.
dump
(
cache
,
fd
,
cP
ickle
.
HIGHEST_PROTOCOL
)
pickle
.
dump
(
cache
,
fd
,
p
ickle
.
HIGHEST_PROTOCOL
)
finally
:
fd
.
close
()
except
IOError
:
if
os
.
path
.
exists
(
self
.
_pickle
):
os
.
remove
(
self
.
_pickle
)
except
cP
ickle
.
PickleError
:
except
p
ickle
.
PickleError
:
if
os
.
path
.
exists
(
self
.
_pickle
):
os
.
remove
(
self
.
_pickle
)
...
...
@@ -324,7 +324,7 @@ class GitConfig(object):
capture_stdout
=
True
,
capture_stderr
=
True
)
if
p
.
Wait
()
==
0
:
return
p
.
stdout
return
str
(
p
.
stdout
,
encoding
=
'UTF-8'
)
else
:
GitError
(
'git config
%
s:
%
s'
%
(
str
(
args
),
p
.
stderr
))
...
...
@@ -701,7 +701,7 @@ class Branch(object):
self
.
_Set
(
'merge'
,
self
.
merge
)
else
:
fd
=
open
(
self
.
_config
.
file
,
'a
b
'
)
fd
=
open
(
self
.
_config
.
file
,
'a
t
'
)
try
:
fd
.
write
(
'[branch "
%
s"]
\n
'
%
self
.
name
)
if
self
.
remote
:
...
...
git_refs.py
View file @
66be4f8a
...
...
@@ -66,7 +66,7 @@ class GitRefs(object):
def
_NeedUpdate
(
self
):
Trace
(
': scan refs
%
s'
,
self
.
_gitdir
)
for
name
,
mtime
in
self
.
_mtime
.
ite
rite
ms
():
for
name
,
mtime
in
self
.
_mtime
.
items
():
try
:
if
mtime
!=
os
.
path
.
getmtime
(
os
.
path
.
join
(
self
.
_gitdir
,
name
)):
return
True
...
...
@@ -89,7 +89,7 @@ class GitRefs(object):
attempts
=
0
while
scan
and
attempts
<
5
:
scan_next
=
{}
for
name
,
dest
in
scan
.
ite
rite
ms
():
for
name
,
dest
in
scan
.
items
():
if
dest
in
self
.
_phyref
:
self
.
_phyref
[
name
]
=
self
.
_phyref
[
dest
]
else
:
...
...
@@ -100,7 +100,7 @@ class GitRefs(object):
def
_ReadPackedRefs
(
self
):
path
=
os
.
path
.
join
(
self
.
_gitdir
,
'packed-refs'
)
try
:
fd
=
open
(
path
,
'r
b
'
)
fd
=
open
(
path
,
'r
t
'
)
mtime
=
os
.
path
.
getmtime
(
path
)
except
IOError
:
return
...
...
@@ -137,7 +137,7 @@ class GitRefs(object):
def
_ReadLoose1
(
self
,
path
,
name
):
try
:
fd
=
open
(
path
,
'r
b
'
)
fd
=
open
(
path
,
'r
t
'
)
except
IOError
:
return
...
...
main.py
View file @
66be4f8a
...
...
@@ -50,6 +50,17 @@ from pager import RunPager
from
subcmds
import
all_commands
REMOTE_DBG
=
True
if
REMOTE_DBG
:
try
:
sys
.
path
.
append
(
"C:
\
Program Files
\
eclipsePython
\
plugins
\
org.python.pydev_2.7.1.2012100913
\
pysrc"
)
import
pydevd
as
pydevd
# stdoutToServer and stderrToServer redirect stdout and stderr to eclipse console
pydevd
.
settrace
(
'localhost'
,
stdoutToServer
=
True
,
stderrToServer
=
True
)
except
ImportError
:
sys
.
stderr
.
write
(
"Error: you must add pydevd in a pysrc folder (e.g. in eclipse plugin) to your PYTHONPATH."
)
sys
.
exit
(
1
)
global_options
=
optparse
.
OptionParser
(
usage
=
"repo [-p|--paginate|--no-pager] COMMAND [ARGS]"
)
...
...
manifest_xml.py
View file @
66be4f8a
...
...
@@ -18,8 +18,9 @@ import itertools
import
os
import
re
import
sys
import
url
parse
import
url
lib
import
xml.dom.minidom
import
xml.parsers.expat
from
git_config
import
GitConfig
from
git_refs
import
R_HEADS
,
HEAD
...
...
@@ -30,8 +31,8 @@ MANIFEST_FILE_NAME = 'manifest.xml'
LOCAL_MANIFEST_NAME
=
'local_manifest.xml'
LOCAL_MANIFESTS_DIR_NAME
=
'local_manifests'
urlparse
.
uses_relative
.
extend
([
'ssh'
,
'git'
])
urlparse
.
uses_netloc
.
extend
([
'ssh'
,
'git'
])
url
lib
.
parse
.
uses_relative
.
extend
([
'ssh'
,
'git'
])
url
lib
.
parse
.
uses_netloc
.
extend
([
'ssh'
,
'git'
])
class
_Default
(
object
):
"""Project defaults within the manifest."""
...
...
@@ -73,7 +74,7 @@ class _XmlRemote(object):
# ie, if manifestUrl is of the form <hostname:port>
if
manifestUrl
.
find
(
':'
)
!=
manifestUrl
.
find
(
'/'
)
-
1
:
manifestUrl
=
'gopher://'
+
manifestUrl
url
=
urlparse
.
urljoin
(
manifestUrl
,
url
)
url
=
url
lib
.
parse
.
urljoin
(
manifestUrl
,
url
)
url
=
re
.
sub
(
r'^gopher://'
,
''
,
url
)
if
p
:
url
=
'persistent-'
+
url
...
...
@@ -388,9 +389,9 @@ class XmlManifest(object):
name
=
self
.
_reqatt
(
node
,
'name'
)
fp
=
os
.
path
.
join
(
include_root
,
name
)
if
not
os
.
path
.
isfile
(
fp
):
raise
ManifestParseError
,
\
raise
ManifestParseError
(
\
"include
%
s doesn't exist or isn't a file"
%
\
(
name
,)
(
name
,)
)
try
:
nodes
.
extend
(
self
.
_ParseManifestXml
(
fp
,
include_root
))
# should isolate this to the exact exception, but that's
...
...
@@ -496,7 +497,7 @@ class XmlManifest(object):
name
=
None
m_url
=
m
.
GetRemote
(
m
.
remote
.
name
)
.
url
if
m_url
.
endswith
(
'/.git'
):
raise
ManifestParseError
,
'refusing to mirror
%
s'
%
m_url
raise
ManifestParseError
(
'refusing to mirror
%
s'
%
m_url
)
if
self
.
_default
and
self
.
_default
.
remote
:
url
=
self
.
_default
.
remote
.
resolvedFetchUrl
...
...
@@ -590,7 +591,7 @@ class XmlManifest(object):
# Figure out minimum indentation, skipping the first line (the same line
# as the <notice> tag)...
minIndent
=
sys
.
max
int
minIndent
=
sys
.
max
size
lines
=
notice
.
splitlines
()
for
line
in
lines
[
1
:]:
lstrippedLine
=
line
.
lstrip
()
...
...
@@ -629,25 +630,25 @@ class XmlManifest(object):
if
remote
is
None
:
remote
=
self
.
_default
.
remote
if
remote
is
None
:
raise
ManifestParseError
,
\
raise
ManifestParseError
(
\
"no remote for project
%
s within
%
s"
%
\
(
name
,
self
.
manifestFile
)
(
name
,
self
.
manifestFile
)
)
revisionExpr
=
node
.
getAttribute
(
'revision'
)
if
not
revisionExpr
:
revisionExpr
=
self
.
_default
.
revisionExpr
if
not
revisionExpr
:
raise
ManifestParseError
,
\
raise
ManifestParseError
(
\
"no revision for project
%
s within
%
s"
%
\
(
name
,
self
.
manifestFile
)
(
name
,
self
.
manifestFile
)
)
path
=
node
.
getAttribute
(
'path'
)
if
not
path
:
path
=
name
if
path
.
startswith
(
'/'
):
raise
ManifestParseError
,
\
raise
ManifestParseError
(
\
"project
%
s path cannot be absolute in
%
s"
%
\
(
name
,
self
.
manifestFile
)
(
name
,
self
.
manifestFile
)
)
rebase
=
node
.
getAttribute
(
'rebase'
)
if
not
rebase
:
...
...
@@ -751,7 +752,7 @@ class XmlManifest(object):
except
ManifestParseError
:
keep
=
"true"
if
keep
!=
"true"
and
keep
!=
"false"
:
raise
ManifestParseError
,
"optional
\"
keep
\"
attribute must be
\"
true
\"
or
\"
false
\"
"
raise
ManifestParseError
(
"optional
\"
keep
\"
attribute must be
\"
true
\"
or
\"
false
\"
"
)
project
.
AddAnnotation
(
name
,
value
,
keep
)
def
_get_remote
(
self
,
node
):
...
...
@@ -761,9 +762,9 @@ class XmlManifest(object):
v
=
self
.
_remotes
.
get
(
name
)
if
not
v
:
raise
ManifestParseError
,
\
raise
ManifestParseError
(
\
"remote
%
s not defined in
%
s"
%
\
(
name
,
self
.
manifestFile
)
(
name
,
self
.
manifestFile
)
)
return
v
def
_reqatt
(
self
,
node
,
attname
):
...
...
@@ -772,7 +773,7 @@ class XmlManifest(object):
"""
v
=
node
.
getAttribute
(
attname
)
if
not
v
:
raise
ManifestParseError
,
\
raise
ManifestParseError
(
\
"no
%
s in <
%
s> within
%
s"
%
\
(
attname
,
node
.
nodeName
,
self
.
manifestFile
)
(
attname
,
node
.
nodeName
,
self
.
manifestFile
)
)
return
v
project.py
View file @
66be4f8a
...
...
@@ -39,14 +39,14 @@ from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M
def
_lwrite
(
path
,
content
):
lock
=
'
%
s.lock'
%
path
fd
=
open
(
lock
,
'w
b
'
)
fd
=
open
(
lock
,
'w
t
'
)
try
:
fd
.
write
(
content
)
finally
:
fd
.
close
()
try
:
os
.
re
nam
e
(
lock
,
path
)
os
.
re
plac
e
(
lock
,
path
)
except
OSError
:
os
.
remove
(
lock
)
raise
...
...
@@ -644,7 +644,7 @@ class Project(object):
all_refs
=
self
.
_allrefs
heads
=
{}
for
name
,
ref_id
in
all_refs
.
ite
rite
ms
():
for
name
,
ref_id
in
all_refs
.
items
():
if
name
.
startswith
(
R_HEADS
):
name
=
name
[
len
(
R_HEADS
):]
b
=
self
.
GetBranch
(
name
)
...
...
@@ -653,7 +653,7 @@ class Project(object):
b
.
revision
=
ref_id
heads
[
name
]
=
b
for
name
,
ref_id
in
all_refs
.
ite
rite
ms
():
for
name
,
ref_id
in
all_refs
.
items
():
if
name
.
startswith
(
R_PUB
):
name
=
name
[
len
(
R_PUB
):]
b
=
heads
.
get
(
name
)
...
...
@@ -849,13 +849,13 @@ class Project(object):
all_refs
=
self
.
_allrefs
heads
=
set
()
canrm
=
{}
for
name
,
ref_id
in
all_refs
.
ite
rite
ms
():
for
name
,
ref_id
in
all_refs
.
items
():
if
name
.
startswith
(
R_HEADS
):
heads
.
add
(
name
)
elif
name
.
startswith
(
R_PUB
):
canrm
[
name
]
=
ref_id
for
name
,
ref_id
in
canrm
.
ite
rite
ms
():
for
name
,
ref_id
in
canrm
.
items
():
n
=
name
[
len
(
R_PUB
):]
if
R_HEADS
+
n
not
in
heads
:
self
.
bare_git
.
DeleteRef
(
name
,
ref_id
)
...
...
@@ -866,14 +866,14 @@ class Project(object):
heads
=
{}
pubed
=
{}
for
name
,
ref_id
in
self
.
_allrefs
.
ite
rite
ms
():
for
name
,
ref_id
in
self
.
_allrefs
.
items
():
if
name
.
startswith
(
R_HEADS
):
heads
[
name
[
len
(
R_HEADS
):]]
=
ref_id
elif
name
.
startswith
(
R_PUB
):
pubed
[
name
[
len
(
R_PUB
):]]
=
ref_id
ready
=
[]
for
branch
,
ref_id
in
heads
.
ite
rite
ms
():
for
branch
,
ref_id
in
heads
.
items
():
if
branch
in
pubed
and
pubed
[
branch
]
==
ref_id
:
continue
if
selected_branch
and
branch
!=
selected_branch
:
...
...
@@ -1597,7 +1597,7 @@ class Project(object):
ids
=
set
(
all_refs
.
values
())
tmp
=
set
()
for
r
,
ref_id
in
GitRefs
(
ref_dir
)
.
all
.
ite
rite
ms
():
for
r
,
ref_id
in
GitRefs
(
ref_dir
)
.
all
.
items
():
if
r
not
in
all_refs
:
if
r
.
startswith
(
R_TAGS
)
or
remote
.
WritesTo
(
r
):
all_refs
[
r
]
=
ref_id
...
...
@@ -2074,7 +2074,7 @@ class Project(object):
else
:
path
=
os
.
path
.
join
(
self
.
_project
.
worktree
,
'.git'
,
HEAD
)
try
:
fd
=
open
(
path
,
'r
b
'
)
fd
=
open
(
path
,
'r
t
'
)
except
IOError
:
raise
NoManifestException
(
path
)
try
:
...
...
@@ -2174,7 +2174,7 @@ class Project(object):
if
not
git_require
((
1
,
7
,
2
)):
raise
ValueError
(
'cannot set config on command line for
%
s()'
%
name
)
for
k
,
v
in
config
.
ite
rite
ms
():
for
k
,
v
in
config
.
items
():
cmdv
.
append
(
'-c'
)
cmdv
.
append
(
'
%
s=
%
s'
%
(
k
,
v
))
cmdv
.
append
(
name
)
...
...
@@ -2189,7 +2189,7 @@ class Project(object):
self
.
_project
.
name
,
name
,
p
.
stderr
))
r
=
p
.
stdout
r
=
str
(
p
.
stdout
,
encoding
=
'UTF-8'
)
if
r
.
endswith
(
'
\n
'
)
and
r
.
index
(
'
\n
'
)
==
len
(
r
)
-
1
:
return
r
[:
-
1
]
return
r
...
...
subcmds/__init__.py
View file @
66be4f8a
...
...
@@ -38,8 +38,8 @@ for py in os.listdir(my_dir):
try
:
cmd
=
getattr
(
mod
,
clsn
)()
except
AttributeError
:
raise
SyntaxError
,
'
%
s/
%
s does not define class
%
s'
%
(
__name__
,
py
,
clsn
)
raise
SyntaxError
(
'
%
s/
%
s does not define class
%
s'
%
(
__name__
,
py
,
clsn
)
)
name
=
name
.
replace
(
'_'
,
'-'
)
cmd
.
NAME
=
name
...
...
subcmds/branches.py
View file @
66be4f8a
...
...
@@ -98,7 +98,7 @@ is shown, then the branch appears in all projects.
project_cnt
=
len
(
projects
)
for
project
in
projects
:
for
name
,
b
in
project
.
GetBranches
()
.
ite
rite
ms
():
for
name
,
b
in
project
.
GetBranches
()
.
items
():
b
.
project
=
project
if
name
not
in
all_branches
:
all_branches
[
name
]
=
BranchInfo
(
name
)
...
...
subcmds/cherry_pick.py
View file @
66be4f8a
...
...
@@ -55,7 +55,7 @@ change id will be added.
if
p
.
Wait
()
!=
0
:
print
(
"error: Failed to retrieve old commit message"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
old_msg
=
self
.
_StripHeader
(
p
.
stdout
)
old_msg
=
self
.
_StripHeader
(
str
(
p
.
stdout
,
encoding
=
'UTF-8'
)
)
p
=
GitCommand
(
None
,
[
'cherry-pick'
,
sha1
],
...
...
subcmds/forall.py
View file @
66be4f8a
...
...
@@ -14,7 +14,7 @@
# limitations under the License.
from
__future__
import
print_function
import
fcntl
#
import fcntl
import
re
import
os
import
select
...
...
@@ -218,47 +218,47 @@ without iterating through the remaining projects.
def
fileno
(
self
):
return
self
.
fd
.
fileno
()
empty
=
True
errbuf
=
''
p
.
stdin
.
close
()
s_in
=
[
sfd
(
p
.
stdout
,
sys
.
stdout
),
sfd
(
p
.
stderr
,
sys
.
stderr
)]
for
s
in
s_in
:
flags
=
fcntl
.
fcntl
(
s
.
fd
,
fcntl
.
F_GETFL
)
fcntl
.
fcntl
(
s
.
fd
,
fcntl
.
F_SETFL
,
flags
|
os
.
O_NONBLOCK
)
while
s_in
:
in_ready
,
_out_ready
,
_err_ready
=
select
.
select
(
s_in
,
[],
[])
for
s
in
in_ready
:
buf
=
s
.
fd
.
read
(
4096
)
if
not
buf
:
s
.
fd
.
close
()
s_in
.
remove
(
s
)
continue
if
not
opt
.
verbose
:
if
s
.
fd
!=
p
.
stdout
:
errbuf
+=
buf
continue
if
empty
:
if
first
:
first
=
False
else
:
out
.
nl
()
out
.
project
(
'project
%
s/'
,
project
.
relpath
)
out
.
nl
()
out
.
flush
()
if
errbuf
:
sys
.
stderr
.
write
(
errbuf
)
sys
.
stderr
.
flush
()
errbuf
=
''
empty
=
False
s
.
dest
.
write
(
buf
)
s
.
dest
.
flush
()
#
empty = True
#
errbuf = ''
#
#
p.stdin.close()
#
s_in = [sfd(p.stdout, sys.stdout),
#
sfd(p.stderr, sys.stderr)]
#
#
for s in s_in:
#
flags = fcntl.fcntl(s.fd, fcntl.F_GETFL)
#
fcntl.fcntl(s.fd, fcntl.F_SETFL, flags | os.O_NONBLOCK)
#
#
while s_in:
#
in_ready, _out_ready, _err_ready = select.select(s_in, [], [])
#
for s in in_ready:
#
buf = s.fd.read(4096)
#
if not buf:
#
s.fd.close()
#
s_in.remove(s)
#
continue
#
#
if not opt.verbose:
#
if s.fd != p.stdout:
#
errbuf += buf
#
continue
#
#
if empty:
#
if first:
#
first = False
#
else:
#
out.nl()
#
out.project('project %s/', project.relpath)
#
out.nl()
#
out.flush()
#
if errbuf:
#
sys.stderr.write(errbuf)
#
sys.stderr.flush()
#
errbuf = ''
#
empty = False
#
#
s.dest.write(buf)
#
s.dest.flush()
r
=
p
.
wait
()
if
r
!=
0
:
...
...
subcmds/grep.py
View file @
66be4f8a
...
...
@@ -210,7 +210,7 @@ contain a line that matches both expressions:
# We cut the last element, to avoid a blank line.
#
r
=
p
.
stdout
.
split
(
'
\n
'
)
r
=
str
(
p
.
stdout
,
encoding
=
'UTF-8'
)
.
split
(
'
\n
'
)
r
=
r
[
0
:
-
1
]
if
have_rev
and
full_name
:
...
...
subcmds/selfupdate.py
deleted
100644 → 0
View file @
2acbeb81
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
print_function
from
optparse
import
SUPPRESS_HELP
import
sys
from
command
import
Command
,
MirrorSafeCommand
from
subcmds.sync
import
_PostRepoUpgrade
from
subcmds.sync
import
_PostRepoFetch
class
Selfupdate
(
Command
,
MirrorSafeCommand
):
common
=
False
helpSummary
=
"Update repo to the latest version"
helpUsage
=
"""
%
prog
"""
helpDescription
=
"""
The '
%
prog' command upgrades repo to the latest version, if a
newer version is available.
Normally this is done automatically by 'repo sync' and does not
need to be performed by an end-user.
"""
def
_Options
(
self
,
p
):
g
=
p
.
add_option_group
(
'repo Version options'
)
g
.
add_option
(
'--no-repo-verify'
,
dest
=
'no_repo_verify'
,
action
=
'store_true'
,
help
=
'do not verify repo source code'
)
g
.
add_option
(
'--repo-upgraded'
,
dest
=
'repo_upgraded'
,
action
=
'store_true'
,
help
=
SUPPRESS_HELP
)
def
Execute
(
self
,
opt
,
args
):
rp
=
self
.
manifest
.
repoProject
rp
.
PreSync
()
if
opt
.
repo_upgraded
:
_PostRepoUpgrade
(
self
.
manifest
)
else
:
if
not
rp
.
Sync_NetworkHalf
():
print
(
"error: can't update repo"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
rp
.
bare_git
.
gc
(
'--auto'
)
_PostRepoFetch
(
rp
,
no_repo_verify
=
opt
.
no_repo_verify
,
verbose
=
True
)
subcmds/status.py
View file @
66be4f8a
...
...
@@ -15,16 +15,16 @@
from
command
import
PagedCommand
try
:
import
threading
as
_threading
except
ImportError
:
import
dummy_threading
as
_threading
#
try:
import
threading
as
_threading
#
except ImportError:
#
import dummy_threading as _threading
import
glob
import
itertools
import
os
import
sys
import
StringIO
import
io
from
color
import
Coloring
...
...
@@ -142,7 +142,7 @@ the following meanings:
for
project
in
all_projects
:
sem
.
acquire
()
class
BufList
(
StringIO
.
StringIO
):
class
BufList
(
io
.
StringIO
.
StringIO
):
def
dump
(
self
,
ostream
):
for
entry
in
self
.
buflist
:
ostream
.
write
(
entry
)
...
...
@@ -182,7 +182,7 @@ the following meanings:
try
:
os
.
chdir
(
self
.
manifest
.
topdir
)
outstring
=
StringIO
.
StringIO
()
outstring
=
io
.
StringIO
.
StringIO
()
self
.
_FindOrphans
(
glob
.
glob
(
'.*'
)
+
\
glob
.
glob
(
'*'
),
\
proj_dirs
,
proj_dirs_parents
,
outstring
)
...
...
subcmds/sync.py
View file @
66be4f8a
...
...
@@ -24,13 +24,13 @@ import socket
import
subprocess
import
sys
import
time
import
url
parse
import
xmlrpc
lib
import
url
lib
import
xmlrpc
try
:
import
threading
as
_threading
except
ImportError
:
import
dummy_threading
as
_threading
#
try:
import
threading
as
_threading
#
except ImportError:
#
import dummy_threading as _threading
try
:
import
resource
...
...
@@ -282,6 +282,8 @@ later is required to fix a server side protocol bug.
else
:
sys
.
exit
(
1
)
else
:
# TODO
# assume jobs=1 always
threads
=
set
()
lock
=
_threading
.
Lock
()
sem
=
_threading
.
Semaphore
(
self
.
jobs
)
...
...
@@ -481,7 +483,7 @@ later is required to fix a server side protocol bug.
file
=
sys
.
stderr
)
else
:
try
:
parse_result
=
url
parse
.
url
parse
(
manifest_server
)
parse_result
=
url
lib
.
parse
(
manifest_server
)
if
parse_result
.
hostname
:
username
,
_account
,
password
=
\
info
.
authenticators
(
parse_result
.
hostname
)
...
...
@@ -499,7 +501,7 @@ later is required to fix a server side protocol bug.
1
)
try
:
server
=
xmlrpc
lib
.
S
erver
(
manifest_server
)
server
=
xmlrpc
.
s
erver
(
manifest_server
)
if
opt
.
smart_sync
:
p
=
self
.
manifest
.
manifestProject
b
=
p
.
GetBranch
(
p
.
CurrentBranch
)
...
...
@@ -537,11 +539,11 @@ later is required to fix a server side protocol bug.
else
:
print
(
'error:
%
s'
%
manifest_str
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
except
(
socket
.
error
,
IOError
,
xmlrpc
lib
.
Fault
)
as
e
:
except
(
socket
.
error
,
IOError
,
xmlrpc
.
client
.
Fault
)
as
e
:
print
(
'error: cannot connect to manifest server
%
s:
\n
%
s'
%
(
self
.
manifest
.
manifest_server
,
e
),
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
except
xmlrpc
lib
.
ProtocolError
as
e
:
except
xmlrpc
.
client
.
ProtocolError
as
e
:
print
(
'error: cannot connect to manifest server
%
s:
\n
%
d
%
s'
%
(
self
.
manifest
.
manifest_server
,
e
.
errcode
,
e
.
errmsg
),
file
=
sys
.
stderr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment