Fossil

Check-in [dc10f8d7]
Login

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

Overview
Comment:Fix problem when using "fossil cat" when specifying repository via command line argument (with -R) (reported on ML)

Problem was the use of file_tree_name() which call db_must_be_within_tree().

Add a variable in the Global structure 'g' to remember if -R|--repository argument was specified and don't call file_tree_name() if it's the case (since user expect file relative to repository.

(Pending review...)

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fix-cat-dash-R
Files: files | file ages | folders
SHA1:dc10f8d74cbdb150bd09c0f9fded8ce9a5d90952
User & Date: mgagnon 2014-03-26 21:54:40
Context
2014-03-31
18:57
Merge trunk..

including use of the urlData object the global "g" variable which fix byte alignment problem.. Closed-Leaf check-in: 7cb29889 user: mgagnon tags: fix-cat-dash-R

2014-03-26
21:54
Fix problem when using "fossil cat" when specifying repository via command line argument (with -R) (reported on ML)

Problem was the use of file_tree_name() which call db_must_be_within_tree().

Add a variable in the Global structure 'g' to remember if -R|--repository argument was specified and don't call file_tree_name() if it's the case (since user expect file relative to repository.

(Pending review...) check-in: dc10f8d7 user: mgagnon tags: fix-cat-dash-R

11:58
3 more "full UUID" cases check-in: f46482a9 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

1044
1045
1046
1047
1048
1049
1050



1051
1052
1053
1054
1055
1056
1057
** option to locate the repository.  If no such option is available, then
** use the repository of the open checkout if there is one.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(int bFlags, int nArgUsed){
  const char *zRep = find_option("repository", "R", 1);



  if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
    zRep = g.argv[nArgUsed];
  }
  if( zRep==0 ){
    if( db_open_local(0)==0 ){
      goto rep_not_found;
    }







>
>
>







1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
** option to locate the repository.  If no such option is available, then
** use the repository of the open checkout if there is one.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(int bFlags, int nArgUsed){
  const char *zRep = find_option("repository", "R", 1);
  if (zRep){
    g.useRepositoryFromCmdArg = 1;
  }
  if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){
    zRep = g.argv[nArgUsed];
  }
  if( zRep==0 ){
    if( db_open_local(0)==0 ){
      goto rep_not_found;
    }

Changes to src/finfo.c.

235
236
237
238
239
240
241











242

243
244
245
246
247
248
249
  int i;
  int rc;
  Blob content, fname;
  const char *zRev;
  db_find_and_open_repository(0, 0);
  zRev = find_option("r","r",1);
  for(i=2; i<g.argc; i++){











    file_tree_name(g.argv[i], &fname, 1);

    blob_zero(&content);
    rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,0);
    if( rc==0 ){
      fossil_fatal("no such file: %s", g.argv[i]);
    }
    blob_write_to_file(&content, "-");
    blob_reset(&fname);







>
>
>
>
>
>
>
>
>
>
>
|
>







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  int i;
  int rc;
  Blob content, fname;
  const char *zRev;
  db_find_and_open_repository(0, 0);
  zRev = find_option("r","r",1);
  for(i=2; i<g.argc; i++){
    if( g.useRepositoryFromCmdArg ){
      /* If specify -R <repository>, arguments should already be the tree-name */
      blob_set(&fname, g.argv[i]);
      /* 
      ** if no rev specified, default to main-branch to don't let
      ** historical_version_of_file() get local checkout revision
      */
      if( zRev==0 ){
        zRev=db_get("main-branch", "trunk");
      }
    }else{
      file_tree_name(g.argv[i], &fname, 1);
    }
    blob_zero(&content);
    rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,0);
    if( rc==0 ){
      fossil_fatal("no such file: %s", g.argv[i]);
    }
    blob_write_to_file(&content, "-");
    blob_reset(&fname);

Changes to src/main.c.

169
170
171
172
173
174
175

176
177
178
179
180
181
182
  int *aCommitFile;       /* Array of files to be committed */
  int markPrivate;        /* All new artifacts are private if true */
  int clockSkewSeen;      /* True if clocks on client and server out of sync */
  int wikiFlags;          /* Wiki conversion flags applied to %w and %W */
  char isHTTP;            /* True if server/CGI modes, else assume CLI. */
  char javascriptHyperlink; /* If true, set href= using script, not HTML */
  Blob httpHeader;        /* Complete text of the HTTP request header */


  /*
  ** NOTE: These members MUST be kept in sync with those in the "UrlData"
  **       structure defined in "url.c".
  */
  int urlIsFile;          /* True if a "file:" url */
  int urlIsHttps;         /* True if a "https:" url */







>







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
  int *aCommitFile;       /* Array of files to be committed */
  int markPrivate;        /* All new artifacts are private if true */
  int clockSkewSeen;      /* True if clocks on client and server out of sync */
  int wikiFlags;          /* Wiki conversion flags applied to %w and %W */
  char isHTTP;            /* True if server/CGI modes, else assume CLI. */
  char javascriptHyperlink; /* If true, set href= using script, not HTML */
  Blob httpHeader;        /* Complete text of the HTTP request header */
  int useRepositoryFromCmdArg; /* -R <repository> specified on command line */

  /*
  ** NOTE: These members MUST be kept in sync with those in the "UrlData"
  **       structure defined in "url.c".
  */
  int urlIsFile;          /* True if a "file:" url */
  int urlIsHttps;         /* True if a "https:" url */