]> thyrsus.com Git - src.git/commitdiff
move and copy are now properly regression tested.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 8 Nov 2014 20:11:38 +0000 (15:11 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 8 Nov 2014 20:11:38 +0000 (15:11 -0500)
src
srctest

diff --git a/src b/src
index c2befc32c7b7eda8be539006ba02ee593ed6bc32..6fa2f78ea9e82b16742b14fd1c289a441c51a751 100755 (executable)
--- a/src
+++ b/src
@@ -724,10 +724,11 @@ def filecmd(legend, hook, args):
     elif not os.path.exists(backend.master(source)):
         croak("%s is not registered, skipping." % source)
     elif os.path.exists(backend.master(target)):
-        croak("%s is registered, I won't step on it")
+        croak("%s is registered, I won't step on it" % source)
     elif os.path.exists(target):
-        croak("%s exists, please delete manually if you want it gone")
-        hook(src, target)
+        croak("%s exists, please delete manually if you want it gone" % target)
+    else:
+        hook(source, target)
 
 def move_method(*args):
     "Move a file and its history."
@@ -813,12 +814,12 @@ class RCS:
         do_or_die("rcs -N{0}:{1} {2}".format(tagname, revision, arg))
     def move(self, source, target):
         "Move a file and its history."
-        do_or_die("mv {0} {1} && mv {2} {3]".format(source, target,
+        do_or_die("mv {0} {1} && mv {2} {3}".format(source, target,
                                                     self.master(source),
                                                     self.master(target))) 
     def copy(self, source, target):
         "Copy a file and its history."
-        do_or_die("cp {0} {1} && cp {2} {3]".format(source, target,
+        do_or_die("cp {0} {1} && cp {2} {3}".format(source, target,
                                                     self.master(source),
                                                     self.master(target))) 
     def moveto(self, arg, target):
diff --git a/srctest b/srctest
index aa0528ca3ff10b5e42846d0a31226ab7f0931a3f..cfa73d4155242c59c1fb035160701fba34846287 100755 (executable)
--- a/srctest
+++ b/srctest
@@ -6,7 +6,7 @@
 # Needs to not be a subdirectory of here, or git gets confused
 SANDBOX=/tmp/src-sandbox
 
-trap "rm -fr testfile* testrev* $SANDBOX" 0 1 2 15
+trap "rm -fr testfile* testrev* newname* $SANDBOX" 0 1 2 15
 
 check() {
     case $? in
@@ -165,11 +165,30 @@ src $TESTOPTS fast-export testfile1 >testfile14
 cat testfile14 | (cd $SANDBOX/foo >/dev/null; git init --quiet; git fast-import --quiet)
 (cd $SANDBOX/foo; git fast-export --all) >testfile15
 diff -u testfile14 testfile15
-check "fast-export" 
-
-src $TESTOPTS rename testfile1 newname
-check "move"
-
-# untested: ls, moveto, copyto, copy
+check "fast-export"
+rm -fr $SANDBOX/foo
+
+src $TESTOPTS rename testfile1 newname1
+check "move command"
+if [ -e newname1 -a -e $SANDBOX/newname1,v ]
+then
+    echo "srctest: content move succeeded"
+else
+    echo "src: content move failed"
+    exit 1
+fi
+
+src $TESTOPTS copy newname1 newname2
+check "copy command"
+if [ -e newname2 -a -e $SANDBOX/newname2,v ]
+then
+    echo "srctest: content copy succeeded"
+else
+    echo "src: content move failed"
+    exit 1
+fi
+
+
+# untested: ls, moveto, copyto
 
 # end