Re: [fossil-users] strange case-sensitivity on Windows

2009-12-17 Thread Wilson, Ronald
 Hi
 This is fossil version [d5695157d0] 2009-11-11 16:21:19 UTC
 
 [D:\Works\xa-db]fossil revert reporting.sql
 revert file 'reporting.sql'? this will destroy local changes [y/N]? y
 D:\PROGRAMS\UTILS\FOSSIL.EXE: no history for file: reporting.sql
 
 [D:\Works\xa-db]fossil revert reporting.SQL
 revert file 'reporting.SQL'? this will destroy local changes [y/N]? y
 reporting.SQL reverted
 
 The first question suggests that reporting.sql and reporting.SQL are
 the same file (as they are on Windows).
 Then the actual revert attempt decides they are different
 This looks like a bug - Should I do anything more about it?
 
 Regards
 Emil

revert_cmd() doesn't check if the file is in the repository until after
it asks you if you're sure.  Also, while inspecting the code, I noticed
that yesRevert is not initialized at the top of the loop, so there could
be unexpected results for multiple files.  See my c++ style comments
below.

void revert_cmd(void){
  char *zFile;
  const char *zRevision;
  Blob fname;
  Blob record;
  Blob ans;
  int i;
  int rid = 0, yesRevert;
  
  yesRevert = find_option(yes, y, 0)!=0;
  zRevision = find_option(revision, r, 1);
  verify_all_options();
  
  if( g.argc3 ){
usage(?OPTIONS FILE ...);
  }
  db_must_be_within_tree();

  for(i=2; ig.argc; i++){
zFile = mprintf(%/, g.argv[i]);
file_tree_name(zFile, fname, 1);
// initialize yesRevert here to the find_option() result above
if( access(zFile, 0) ) yesRevert = 1;  
// check here if there is history for the file before prompting the user
if( yesRevert==0 ){ 
  char *prompt = mprintf(revert file %B? this will
  destroy local changes (y/N)? ,
 fname);
  blob_zero(ans);
  prompt_user(prompt, ans);
  free( prompt );
  if( blob_str(ans)[0]=='y' ){
yesRevert = 1;
  }
  blob_reset(ans);
}

if( yesRevert==1  zRevision!=0 ){
  historical_version_of_file(zRevision, zFile, record);
}else if( yesRevert==1 ){
  rid = db_int(0, SELECT rid FROM vfile WHERE pathname=%B,
fname);
  if( rid==0 ){
fossil_panic(no history for file: %b, fname);
  }
  content_get(rid, record);
}
  
if( yesRevert==1 ){
  blob_write_to_file(record, zFile);
  printf(%s reverted\n, zFile);
  blob_reset(record);
  blob_reset(fname);
}else{
  printf(revert canceled\n);
}
free(zFile);
  }
}

I can make the changes if you want.

RW

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division
assuredcommunications(tm)

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] strange case-sensitivity on Windows

2009-12-17 Thread Wilson, Ronald
 I was working on that earlier today.  Maybe I messed something up.
 
 While out running just now, it occurred to me that we really ought to
 get rid of the --yes switch on revert all together and just make it
 do the revert without confirmation.  But also make revert undoable,
 so if you accidently revert some work that you really wanted to keep,
 you can just fossil undo to get it back.
 
 
 D. Richard Hipp
 d...@hwaci.com


Ok I'll wait to see what you come up with.

RW

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division
assuredcommunications(tm)

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users