Fossil

Check-in [420a5fc0]
Login

Check-in [420a5fc0]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed inconsistent calls to usage() in the attachment command which result in printing the fossil command name twice in the Usage: message.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | technoteattachcli
Files: files | file ages | folders
SHA1: 420a5fc0bf0d3b5c39aea72ccad852f64d135113
User & Date: rberteig 2016-03-24 18:28:20.034
Context
2016-03-24
22:27
Fixed some typos and attempted to improve documentation of the fossil wiki command. Added and rearranged test casesd for fossil wiki to explicitly include a knownBug case for the collision between a previous attachment and a new technote that happen to occur in the same second. Note that the reverse order does not fail, as demonstrated by some additional tests. ... (check-in: b81125e2 user: rberteig tags: technoteattachcli)
18:28
Fixed inconsistent calls to usage() in the attachment command which result in printing the fossil command name twice in the Usage: message. ... (check-in: 420a5fc0 user: rberteig tags: technoteattachcli)
2016-03-23
21:19
Add a 1.2 sec delay before the test wiki-30 because it explicitly uses the current date and time, and other changes made to technotes implicitly use the current time, causing a technote name collision if the test script happens to execute with the relevent bits happening within the same wall clock second, at least on Windows. This is partly a kludge to make this test case pass reliably. It would probably be better for test cases to not have more than one reference to 'now' in a way that would cause a name collision, that is worth further investigation. Also, at first glance it doesn't look like the suite actually created to technotes at the same second, but rather it was one of the edits to an older technote that is causing the collision. ... (check-in: c29c75c9 user: rberteig tags: technoteattachcli)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/attach.c.
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
    char *zBody = 0;              /* Wiki page content */
    int rid;
    const char *zTarget;          /* Target of the attachment */
    Blob content;                 /* The content of the attachment */
    zETime = find_option("technote","t",1);
    if( !zETime ){
      if( g.argc!=5 ){
        usage("attachment add PAGENAME FILENAME");
      }
      zPageName = g.argv[3];
      rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
        " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
        " ORDER BY x.mtime DESC LIMIT 1",
        zPageName
      );        
      if( (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
        zBody = pWiki->zWiki;
      }
      if( zBody==0 ){
        fossil_fatal("wiki page [%s] not found",zPageName);
      }
      zTarget = zPageName;
      zFile = g.argv[4];
    }else{
      if( g.argc!=4 ){
        usage("attachment add FILENAME --technote DATETIME");
      }
      rid = db_int(0, "SELECT objid FROM event"
        " WHERE datetime(mtime)=datetime('%q') AND type='e'"
        " ORDER BY mtime DESC LIMIT 1",
        zETime
      );
      if( (pWiki = manifest_get(rid, CFTYPE_EVENT, 0))!=0 ){







|

















|







712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
    char *zBody = 0;              /* Wiki page content */
    int rid;
    const char *zTarget;          /* Target of the attachment */
    Blob content;                 /* The content of the attachment */
    zETime = find_option("technote","t",1);
    if( !zETime ){
      if( g.argc!=5 ){
        usage("add PAGENAME FILENAME");
      }
      zPageName = g.argv[3];
      rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x"
        " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'"
        " ORDER BY x.mtime DESC LIMIT 1",
        zPageName
      );        
      if( (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){
        zBody = pWiki->zWiki;
      }
      if( zBody==0 ){
        fossil_fatal("wiki page [%s] not found",zPageName);
      }
      zTarget = zPageName;
      zFile = g.argv[4];
    }else{
      if( g.argc!=4 ){
        usage("add FILENAME --technote DATETIME");
      }
      rid = db_int(0, "SELECT objid FROM event"
        " WHERE datetime(mtime)=datetime('%q') AND type='e'"
        " ORDER BY mtime DESC LIMIT 1",
        zETime
      );
      if( (pWiki = manifest_get(rid, CFTYPE_EVENT, 0))!=0 ){
770
771
772
773
774
775
776
777
778
    }
  }else{
    goto attachment_cmd_usage;
  }
  return;

attachment_cmd_usage:
  usage("attachment add ?PAGENAME? FILENAME [-t|--technote DATETIME ]");
}







|

770
771
772
773
774
775
776
777
778
    }
  }else{
    goto attachment_cmd_usage;
  }
  return;

attachment_cmd_usage:
  usage("add ?PAGENAME? FILENAME [-t|--technote DATETIME ]");
}