From: Eric S. Raymond Date: Sat, 8 Nov 2014 20:11:38 +0000 (-0500) Subject: move and copy are now properly regression tested. X-Git-Tag: 0.2~6 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=168b662c01c919df6a0a5edaf66cf0cefd5e5565;p=src.git move and copy are now properly regression tested. --- diff --git a/src b/src index c2befc3..6fa2f78 100755 --- 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 aa0528c..cfa73d4 100755 --- 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