Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
097c55ad
Kaydet (Commit)
097c55ad
authored
Nis 27, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
accept more invalid dates
when reading sums file, ignore files not in entries
üst
c51237cd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
149 additions
and
67 deletions
+149
-67
rcvs.py
Demo/pdist/rcvs.py
+149
-67
No files found.
Demo/pdist/rcvs.py
Dosyayı görüntüle @
097c55ad
#! /usr/local/bin/python
"Remote CVS -- command line interface"
from
cvslib
import
CVS
,
Entry
import
RCSProxy
import
client
import
md5
import
os
import
string
...
...
@@ -15,6 +17,8 @@ def ignored(file):
for
pat
in
ignored_patterns
:
if
fnmatch
.
fnmatch
(
file
,
pat
):
return
1
return
0
def
not_ignored
(
file
):
return
not
ignored
(
file
)
class
PCVS
(
CVS
):
...
...
@@ -32,50 +36,160 @@ class PCVS(CVS):
sum
=
self
.
proxy
.
sum
((
file
,
e
.
rev
))
e
.
setsum
(
sum
)
def
prepare
(
self
):
self
.
localfiles
=
filter
(
not_ignored
,
os
.
listdir
(
os
.
curdir
))
self
.
localfiles
.
sort
()
self
.
entryfiles
=
self
.
keys
()
self
.
remotefiles
=
self
.
proxy
.
listfiles
()
self
.
rcsfiles
=
self
.
entryfiles
[:]
for
file
in
self
.
remotefiles
:
if
file
not
in
self
.
rcsfiles
:
self
.
rcsfiles
.
append
(
file
)
self
.
rcsfiles
.
sort
()
self
.
localonlyfiles
=
[]
for
file
in
self
.
localfiles
:
if
file
not
in
self
.
rcsfiles
:
self
.
localonlyfiles
.
append
(
file
)
self
.
localonlyfiles
.
sort
()
self
.
allfiles
=
self
.
rcsfiles
+
self
.
localonlyfiles
self
.
allfiles
.
sort
()
def
preparedetails
(
self
,
file
):
entry
=
file
in
self
.
entryfiles
if
entry
:
e
=
self
.
entries
[
file
]
else
:
e
=
Entry
(
'/
%
s/0///'
%
file
)
e
.
entry
=
entry
e
.
local
=
file
in
self
.
localfiles
e
.
remote
=
file
in
self
.
remotefiles
if
e
.
local
:
e
.
lsum
=
sumfile
(
file
)
else
:
e
.
lsum
=
None
if
e
.
remote
:
e
.
rrev
=
self
.
proxy
.
head
(
file
)
if
e
.
rrev
==
e
.
rev
:
e
.
rsum
=
e
.
sum
else
:
e
.
rsum
=
self
.
proxy
.
sum
(
file
)
else
:
e
.
rrev
=
'0'
e
.
rsum
=
None
return
e
def
report
(
self
):
self
.
prepare
()
for
file
in
self
.
allfiles
:
e
=
self
.
preparedetails
(
file
)
if
e
.
lsum
==
e
.
sum
==
e
.
rsum
:
# All three exist and are equal
print
'='
,
file
elif
e
.
lsum
==
e
.
sum
:
# Not modified locally, remote update pending
if
e
.
lsum
is
None
:
print
'N'
,
file
,
'(new remote)'
else
:
print
'U'
,
file
elif
e
.
sum
==
e
.
rsum
:
# No remote update, modified locally
if
e
.
rsum
is
None
:
if
e
.
new
:
print
'A'
,
file
else
:
print
'?'
,
file
else
:
if
e
.
lsum
is
None
:
print
'LOST'
,
file
else
:
print
'M'
,
file
else
:
# Conflict: remote update and locally modified
if
e
.
lsum
==
e
.
rsum
:
# Local and remote match!
print
'c'
,
file
else
:
print
'C'
,
file
def
fullcheck
(
self
):
self
.
prepare
()
ok
=
1
for
file
in
self
.
keys
():
e
=
self
.
entries
[
file
]
for
file
in
self
.
allfiles
:
if
file
not
in
self
.
entryfiles
\
and
file
not
in
self
.
remotefiles
:
continue
e
=
self
.
preparedetails
(
file
)
if
e
.
new
:
if
self
.
proxy
.
isfile
(
file
)
:
print
"
%
s: created by someone else
!"
if
e
.
rrev
:
print
"
%
s: created by someone else
"
%
file
ok
=
0
continue
rrev
=
self
.
proxy
.
head
(
file
)
if
rrev
!=
e
.
rev
:
if
e
.
rrev
!=
e
.
rev
:
print
"
%
s: out of date (
%
s vs.
%
s)"
%
\
(
file
,
e
.
rev
,
rrev
)
ok
=
0
return
ok
def
update
(
self
):
for
file
in
self
.
keys
():
e
=
self
.
entries
[
file
]
if
e
.
new
:
print
'A'
,
file
continue
rrev
=
self
.
proxy
.
head
(
file
)
lsum
=
sumfile
(
file
)
if
rrev
==
e
.
rev
:
if
lsum
==
e
.
sum
:
self
.
prepare
()
for
file
in
self
.
rcsfiles
:
e
=
self
.
preparedetails
(
file
)
if
e
.
lsum
==
e
.
sum
==
e
.
rsum
:
print
'='
,
file
continue
if
e
.
sum
==
e
.
rsum
:
if
e
.
rev
!=
e
.
rrev
:
print
'
%
s:
%
s ->
%
s w/o change'
%
\
(
file
,
e
.
rev
,
e
.
rrev
)
e
.
rev
=
e
.
rrev
if
e
.
lsum
!=
e
.
sum
:
if
e
.
lsum
is
None
:
print
'
%
s: file was lost'
%
\
(
file
,)
self
.
get
(
e
)
elif
e
.
new
:
print
'A'
,
file
else
:
print
'M'
,
file
continue
if
e
.
sum
!=
lsum
:
print
"
%
s: conflict -- not updated"
%
file
if
e
.
lsum
==
e
.
sum
:
if
e
.
rev
==
e
.
rrev
:
print
'
%
s: no new revision'
%
file
print
'U'
,
file
,
sys
.
stdout
.
flush
()
self
.
get
(
e
)
print
continue
if
e
.
lsum
==
e
.
rsum
:
print
'c'
,
file
print
e
.
__dict__
e
.
rev
=
e
.
rrev
e
.
sum
=
e
.
rsum
e
.
new
=
e
.
sum
is
None
and
e
.
lsum
is
not
None
if
e
.
sum
:
e
.
mtime
,
e
.
ctime
=
os
.
stat
(
e
.
file
)[
-
2
:]
print
e
.
__dict__
self
.
entries
[
file
]
=
e
continue
print
"
%
s: getting ..."
%
file
data
=
self
.
proxy
.
get
(
file
)
f
=
open
(
file
,
'w'
)
print
'C'
,
file
,
'(not resolved)'
self
.
writeentries
()
self
.
writesums
()
def
get
(
self
,
e
):
data
=
self
.
proxy
.
get
(
e
.
file
)
f
=
open
(
e
.
file
,
'w'
)
f
.
write
(
data
)
f
.
close
()
nsum
=
md5
.
new
(
data
)
.
digest
()
e
.
setsum
(
nsum
)
e
.
rev
=
rrev
print
'U'
,
file
self
.
writeentries
()
self
.
writesums
()
e
.
mtime
,
e
.
ctime
=
os
.
stat
(
e
.
file
)[
-
2
:]
e
.
new
=
0
e
.
rev
=
e
.
rrev
def
commit
(
self
):
if
not
self
.
fullcheck
():
...
...
@@ -102,6 +216,7 @@ class PCVS(CVS):
self
.
proxy
.
put
(
file
,
data
,
message
)
e
.
rev
=
self
.
proxy
.
head
(
file
)
e
.
setsum
(
self
.
proxy
.
sum
(
file
))
e
.
new
=
0
# XXX get it?
mtime
,
ctime
=
os
.
stat
(
file
)[
-
2
:]
e
.
mtime
=
mtime
...
...
@@ -109,45 +224,9 @@ class PCVS(CVS):
self
.
writeentries
()
self
.
writesums
()
def
report
(
self
):
keys
=
self
.
keys
()
files
=
os
.
listdir
(
os
.
curdir
)
allfiles
=
files
for
file
in
keys
:
if
file
not
in
allfiles
:
allfiles
.
append
(
file
)
allfiles
.
sort
()
for
file
in
allfiles
:
if
file
not
in
keys
:
if
not
ignored
(
file
):
print
'?'
,
file
continue
if
file
not
in
files
:
print
file
,
': lost'
continue
e
=
self
.
entries
[
file
]
if
not
os
.
path
.
exists
(
file
):
print
"
%
s: lost"
%
file
continue
if
e
.
new
:
print
'A'
,
file
continue
lsum
=
sumfile
(
file
)
rrev
=
self
.
proxy
.
head
(
file
)
if
rrev
==
e
.
rev
:
if
lsum
==
e
.
sum
:
print
'='
,
file
else
:
print
'M'
,
file
else
:
if
lsum
==
e
.
sum
:
print
'U'
,
file
else
:
print
'C'
,
file
def
add
(
self
,
file
):
if
self
.
entries
.
has_key
(
file
):
print
"
%
s: already known"
print
"
%
s: already known"
%
file
else
:
self
.
entries
[
file
]
=
Entry
(
'/
%
s/0/Initial
%
s//
\n
'
%
(
file
,
file
))
...
...
@@ -158,10 +237,14 @@ def sumfile(file):
def
test
():
proxy
=
RCSProxy
.
RCSProxyClient
((
'voorn.cwi.nl'
,
4127
))
proxy
.
cd
(
'/ufs/guido/voorn/python-RCS/Demo/pdist'
)
import
sys
import
getopt
from
rcsclient
import
openrcsclient
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'd:h:p:vq'
)
proxy
=
openrcsclient
(
opts
)
x
=
PCVS
(
proxy
)
args
=
sys
.
argv
[
1
:]
if
args
:
cmd
=
args
[
0
]
files
=
args
[
1
:]
...
...
@@ -186,7 +269,6 @@ def test():
print
"Unknown command"
,
cmd
else
:
x
.
report
()
if
sys
.
argv
[
1
:]:
x
.
writesums
()
if
__name__
==
"__main__"
:
test
()
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