From 93c883946d98a93e4b7b9aa3c9ee0f9bf35e1570 Mon Sep 17 00:00:00 2001 From: xsa Date: Fri, 5 Jan 2007 07:13:49 +0000 Subject: - introduce file comparison routine, cvs_file_cmp(). - compare the in working dir and the one in CVS/Base/ for the unedit command. hints otto@, input and ok ray@ niallo@. --- usr.bin/cvs/edit.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'usr.bin/cvs/edit.c') 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 * @@ -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); -- cgit v1.2.3-59-g8ed1b