Fossil

Check-in [11b7fa69]
Login

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

Overview
Comment:Display "fork" status on "fossil info", "fossil status" and related commands as well.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | update-fork-warn
Files: files | file ages | folders
SHA1: 11b7fa691499c0475cdde809337b67caacb0e5a8
User & Date: jan.nijtmans 2015-04-10 16:35:51
Context
2015-04-10
17:33
Only check for forks on "open" leaves, otherwise we cannot do anything about it from here anyway. Thanks to Andy Bradford for noticing this. Closed-Leaf check-in: 72794ec9 user: jan.nijtmans tags: update-fork-warn
16:35
Display "fork" status on "fossil info", "fossil status" and related commands as well. check-in: 11b7fa69 user: jan.nijtmans tags: update-fork-warn
07:55
Add a warning to "fossil update" when a fork has occurred. check-in: 32998a20 user: jan.nijtmans tags: update-fork-warn
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/info.c.

46
47
48
49
50
51
52


53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
...
109
110
111
112
113
114
115
116



117
118
119
120
121
122
123
124
...
133
134
135
136
137
138
139

140
141
142
143
144
145
146
/*
** Print common information about a particular record.
**
**     *  The UUID
**     *  The record ID
**     *  mtime and ctime
**     *  who signed it


*/
void show_common_info(
  int rid,                   /* The rid for the check-in to display info for */
  const char *zUuidName,     /* Name of the UUID */
  int showComment,           /* True to show the check-in comment */
  int showFamily             /* True to show parents and children */
){
  Stmt q;
  char *zComment = 0;
  char *zTags;
  char *zDate;
  char *zUuid;

  zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
  if( zUuid ){
    zDate = db_text(0,
      "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
      rid
    );
         /* 01234567890123 */
................................................................................
      fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
      free(zDate);
    }
    db_finalize(&q);
  }
  if( zUuid ){
    fossil_print("%-13s ", "leaf:");
    if(is_a_leaf(rid)){



      if(db_int(0, "SELECT 1 FROM tagxref AS tx"
                " WHERE tx.rid=%d"
                " AND tx.tagid=%d"
                " AND tx.tagtype>0",
                rid, TAG_CLOSED)){
        fossil_print("%s\n", "closed");
      }else{
        fossil_print("%s\n", "open");
................................................................................
  }
  free(zTags);
  if( zComment ){
    fossil_print("comment:      ");
    comment_print(zComment, 0, 14, -1, g.comFmtFlags);
    free(zComment);
  }

}

/*
** Print information about the URLs used to access a repository and
** checkouts in a repository.
*/
static void extraRepoInfo(void){







>
>

|










>







 







|
>
>
>
|







 







>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
** Print common information about a particular record.
**
**     *  The UUID
**     *  The record ID
**     *  mtime and ctime
**     *  who signed it
**
** Returns 1 when a fork was found.
*/
int show_common_info(
  int rid,                   /* The rid for the check-in to display info for */
  const char *zUuidName,     /* Name of the UUID */
  int showComment,           /* True to show the check-in comment */
  int showFamily             /* True to show parents and children */
){
  Stmt q;
  char *zComment = 0;
  char *zTags;
  char *zDate;
  char *zUuid;
  int isFork = 0;
  zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
  if( zUuid ){
    zDate = db_text(0,
      "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
      rid
    );
         /* 01234567890123 */
................................................................................
      fossil_print("%-13s %s %s\n", zType, zUuid, zDate);
      free(zDate);
    }
    db_finalize(&q);
  }
  if( zUuid ){
    fossil_print("%-13s ", "leaf:");
    if( is_a_leaf(rid) ){
      if( fossil_find_nearest_fork(rid) ){
        fossil_print("%s\n", "fork");
        isFork = 1;
      }else if(db_int(0, "SELECT 1 FROM tagxref AS tx"
                " WHERE tx.rid=%d"
                " AND tx.tagid=%d"
                " AND tx.tagtype>0",
                rid, TAG_CLOSED)){
        fossil_print("%s\n", "closed");
      }else{
        fossil_print("%s\n", "open");
................................................................................
  }
  free(zTags);
  if( zComment ){
    fossil_print("comment:      ");
    comment_print(zComment, 0, 14, -1, g.comFmtFlags);
    free(zComment);
  }
  return isFork;
}

/*
** Print information about the URLs used to access a repository and
** checkouts in a repository.
*/
static void extraRepoInfo(void){

Changes to src/update.c.

119
120
121
122
123
124
125

126
127
128
129
130
131
132
...
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
...
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
  int i;                /* Loop counter */
  int nConflict = 0;    /* Number of merge conflicts */
  int nOverwrite = 0;   /* Number of unmanaged files overwritten */
  int nUpdate = 0;      /* Number of changes of any kind */
  int width;            /* Width of printed comment lines */
  Stmt mtimeXfer;       /* Statement to transfer mtimes */
  const char *zWidth;   /* Width option string value */


  if( !internalUpdate ){
    undo_capture_command_line();
    url_proxy_options();
  }
  zWidth = find_option("width","W",1);
  if( zWidth ){
................................................................................
    free(zFullPath);
    free(zFullNewPath);
  }
  db_finalize(&q);
  db_finalize(&mtimeXfer);
  fossil_print("%.79c\n",'-');
  if( nUpdate==0 ){
    show_common_info(tid, "checkout:", 1, 0);
    fossil_print("%-13s None. Already up-to-date\n", "changes:");
  }else{
    show_common_info(tid, "updated-to:", 1, 0);
    fossil_print("%-13s %d file%s modified.\n", "changes:",
                 nUpdate, nUpdate>1 ? "s" : "");
  }

  /* Report on conflicts
  */
  if( !dryRunFlag ){
................................................................................
    if( nOverwrite ){
      fossil_warning("WARNING: %d unmanaged files were overwritten",
                     nOverwrite);
    }
    if( nMerge ){
      fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
    }
    if( fossil_find_nearest_fork(tid) ){
      fossil_warning("WARNING: fork detected, please do a \"fossil merge\"");
    }
  }

  /*
  ** Clean up the mid and pid VFILE entries.  Then commit the changes.
  */







>







 







|


|







 







|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
...
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
...
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
  int i;                /* Loop counter */
  int nConflict = 0;    /* Number of merge conflicts */
  int nOverwrite = 0;   /* Number of unmanaged files overwritten */
  int nUpdate = 0;      /* Number of changes of any kind */
  int width;            /* Width of printed comment lines */
  Stmt mtimeXfer;       /* Statement to transfer mtimes */
  const char *zWidth;   /* Width option string value */
  int isFork;

  if( !internalUpdate ){
    undo_capture_command_line();
    url_proxy_options();
  }
  zWidth = find_option("width","W",1);
  if( zWidth ){
................................................................................
    free(zFullPath);
    free(zFullNewPath);
  }
  db_finalize(&q);
  db_finalize(&mtimeXfer);
  fossil_print("%.79c\n",'-');
  if( nUpdate==0 ){
    isFork = show_common_info(tid, "checkout:", 1, 0);
    fossil_print("%-13s None. Already up-to-date\n", "changes:");
  }else{
    isFork = show_common_info(tid, "updated-to:", 1, 0);
    fossil_print("%-13s %d file%s modified.\n", "changes:",
                 nUpdate, nUpdate>1 ? "s" : "");
  }

  /* Report on conflicts
  */
  if( !dryRunFlag ){
................................................................................
    if( nOverwrite ){
      fossil_warning("WARNING: %d unmanaged files were overwritten",
                     nOverwrite);
    }
    if( nMerge ){
      fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
    }
    if( isFork ){
      fossil_warning("WARNING: fork detected, please do a \"fossil merge\"");
    }
  }

  /*
  ** Clean up the mid and pid VFILE entries.  Then commit the changes.
  */