[stsf-commit] scripts dirsync.py,1.4,1.5
Alexander Gelfenbain
stsf-commit at pdx.freedesktop.org
Fri Jun 4 22:41:10 PDT 2004
Committed by: adg
Index: dirsync.py
===================================================================
RCS file: /cvs/stsf/scripts/dirsync.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/dirsync.py 1 Apr 2004 19:47:55 -0000 1.4
+++ b/dirsync.py 5 Jun 2004 05:41:07 -0000 1.5
@@ -40,7 +40,7 @@
#
# @file dirsync.py
# @brief Script to synchronize two directory trees
-# @version 0.3.3
+# @version 0.3.5
# @author Alexander Gelfenbain <adg at sun.com>
#
@@ -57,8 +57,8 @@
import fcntl
import struct
-VERSION = '0.3.3'
-LASTCHANGED = '2004-03-31'
+VERSION = '0.3.5'
+LASTCHANGED = '2004-04-14'
LOADTREE_SVN = 1
LOADTREE_TEAMWARE = 2
@@ -84,6 +84,8 @@
dflag = 0
advance = 0
numflag = 1
+rflag = 1 # Recursively compare sub-directories
+xflag = 0 # Only conflicting files
OBJECT_SUFFIXES = ['.o', '.so']
@@ -130,19 +132,32 @@
Unless -s options specified, dirsync.py lists all files
except starting with "."
- -h print this message and exit (--help)
- -v print version and exit (--version)
- -c print the editor and the visual (--check-env)
- merge program names
- -a include identical files in the listing (--all)
- -m merge conflicting files using $VISDIFF (--merge)
- or gvimdiff
- -s turn on SCCS mode (--sccs)
- -o turn on SCCS 'list-only' mode (--sccs-listonly)
- -b include object files (*.o and *.so) (--object-files)
- -d do not print identical directories and files (--min-output)
- -n <num> skip num first files when synchronizing trees (--advance)
- -p do not print sequence numbers in the tree diff output (--no-num)
+ -h (--help)
+ print this message and exit
+ -v (--version)
+ print version and exit
+ -c (--check-env)
+ print the editor and the visual merge program names
+ -a (--all)
+ include identical files in the listing
+ -m (--merge)
+ merge conflicting files using $VISDIFF or gvimdiff
+ -s (--sccs)
+ turn on SCCS mode
+ -o (--sccs-listonly)
+ turn on SCCS 'list-only' mode
+ -b (--object-files)
+ include object files (*.o and *.so)
+ -d (--min-output)
+ do not print identical directories and files
+ -n <num> (--advance <num>)
+ skip num first files when synchronizing trees
+ -p (--no-num)
+ do not print sequence numbers in the tree diff output
+ -r (--no-recursive)
+ do not recursively descend into subdirectories
+ -x (--conflicts-only)
+ merge only different files, skip missing files
In SCCS and in SCCS list-only modes:
@@ -436,9 +451,10 @@
elif f == 'SCCS':
r = LOADTREE_TEAMWARE
else:
- s = LoadTree(basedir, join(subdir, f), level+1, tree)
- if r != LOADTREE_UNKNOWN and s != LOADTREE_UNKNOWN and s != r:
- print 'Undetermined repository type: ', join(basedir, subdir, f)
+ if rflag:
+ s = LoadTree(basedir, join(subdir, f), level+1, tree)
+ if r != LOADTREE_UNKNOWN and s != LOADTREE_UNKNOWN and s != r:
+ print 'Undetermined repository type: ', join(basedir, subdir, f)
elif isfile(ff) and not islink(ff):
if (sccsflag or sccslistonly) and 'SCCS' in dirlist:
sccsdir = join(dirname, 'SCCS')
@@ -580,6 +596,7 @@
def MergeTrees():
global VISDIFF, advance
+ global xflag
for i in range(advance, len(reslist)):
citem = reslist[i]
if citem[0] == FILES_CONFLICT:
@@ -628,6 +645,9 @@
else:
break
+ elif xflag == 1:
+ continue
+
elif citem[0] == FILECOPY_LTR or citem[0] == FILECOPY_RTL:
src = citem[4]
dst = join(citem[5], citem[1])
@@ -748,13 +768,13 @@
def main():
- global sccsflag, sccslistonly, bflag, dflag, advance, numflag
+ global sccsflag, sccslistonly, bflag, dflag, advance, numflag, rflag, xflag
ltree = {}
rtree = {}
versflag = hflag = vflag = cflag = mflag = 0
try:
- opts, args = getopt.getopt(sys.argv[1:], "abvhcmsodn:p",
+ opts, args = getopt.getopt(sys.argv[1:], "abvhcmsodn:prx",
['help',
'check-env',
'merge',
@@ -765,7 +785,9 @@
'object-files',
'min-output',
'advance=',
- 'no-num'
+ 'no-num',
+ 'no-recursive',
+ 'conflicts-only'
])
except getopt.GetoptError:
PrintCopr()
@@ -796,6 +818,10 @@
advance=int(a)
elif o in ('-p', '--no-num'):
numflag = 0
+ elif o in ('-r', '--no-recursive'):
+ rflag = 0
+ elif o in ('-x', '--conflicts-only'):
+ xflag = 1
if versflag:
PrintCopr()
More information about the stsf-commit
mailing list