summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/edit.c
diff options
context:
space:
mode:
authorxsa <xsa@openbsd.org>2007-01-05 07:13:49 +0000
committerxsa <xsa@openbsd.org>2007-01-05 07:13:49 +0000
commit93c883946d98a93e4b7b9aa3c9ee0f9bf35e1570 (patch)
tree55b6dc8bda63057157f19c1bf9552827876f623e /usr.bin/cvs/edit.c
parentFirst shot of making the driver capable to parse several firmware files (diff)
downloadwireguard-openbsd-93c883946d98a93e4b7b9aa3c9ee0f9bf35e1570.tar.xz
wireguard-openbsd-93c883946d98a93e4b7b9aa3c9ee0f9bf35e1570.zip
- introduce file comparison routine, cvs_file_cmp().
- compare the <file> in working dir and the one in CVS/Base/<file> for the unedit command. hints otto@, input and ok ray@ niallo@.
Diffstat (limited to 'usr.bin/cvs/edit.c')
-rw-r--r--usr.bin/cvs/edit.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/cvs/edit.c b/usr.bin/cvs/edit.c
index b745509e20d..189d688b70d 100644
--- a/usr.bin/cvs/edit.c
+++ b/usr.bin/cvs/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.16 2007/01/03 09:49:37 xsa Exp $ */
+/* $OpenBSD: edit.c,v 1.17 2007/01/05 07:13:49 xsa Exp $ */
/*
* Copyright (c) 2006, 2007 Xavier Santolaria <xsa@openbsd.org>
*
@@ -177,7 +177,15 @@ cvs_unedit_local(struct cvs_file *cf)
return;
}
- /* XXX: compare cf->file_path and bfpath */
+ if (cvs_file_cmp(cf->file_path, bfpath) != 0) {
+ cvs_printf("%s has been modified; revert changes? ",
+ cf->file_name);
+
+ if (cvs_yesno() == -1) {
+ xfree(bfpath);
+ return;
+ }
+ }
cvs_rename(bfpath, cf->file_path);
xfree(bfpath);