Changes On Branch update-fork-warn
Not logged in

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

Changes In Branch update-fork-warn Excluding Merge-Ins

This is equivalent to a diff from d397f1cdc4 to 72794ec975

2015-04-13
08:29
Better fork detection on fossil update, fossil status and related commands. check-in: 5c40f8565e user: jan.nijtmans tags: trunk
03:31
Bring in needed changes from related branch. check-in: ebce686332 user: andybradford tags: sync-forkwarn
2015-04-11
01:56
Pull in latest from trunk. check-in: 4f734aa219 user: andybradford tags: sync-forkwarn
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: 72794ec975 user: jan.nijtmans tags: update-fork-warn
16:35
Display "fork" status on "fossil info", "fossil status" and related commands as well. check-in: 11b7fa6914 user: jan.nijtmans tags: update-fork-warn
07:55
Add a warning to "fossil update" when a fork has occurred. check-in: 32998a20f9 user: jan.nijtmans tags: update-fork-warn
05:31
Minor correction to comment, no code change. check-in: d397f1cdc4 user: andybradford tags: trunk
00:45
Remove superfluous slash from '.fossil-settings' path construction in print_setting(). check-in: fad1dd0a8e user: mistachkin tags: trunk

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
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







+
+

-
+










+







/*
** 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.
*/
void show_common_info(
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 */
109
110
111
112
113
114
115
116
117
118
119
120
121






122



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
112
113
114
115
116
117
118






119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153







-
-
-
-
-
-
+
+
+
+
+
+

+
+
+

















+







      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)){
    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 if( fossil_find_nearest_fork(rid) ){
        fossil_print("%s\n", "fork");
        isFork = 1;
      }else{
        fossil_print("%s\n", "open");
      }
    }else{
      fossil_print("no\n");
    }
  }
  zTags = info_tags_of_checkin(rid, 0);
  if( zTags && zTags[0] ){
    fossil_print("tags:         %s\n", zTags);
  }
  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/merge.c.
51
52
53
54
55
56
57
























58
59
60
61
62
63
64
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







       indent, "");
    comment_print(zCom, db_column_text(&q,2), indent, -1, g.comFmtFlags);
    fossil_free(zCom);
  }
  db_finalize(&q);
}


/* Pick the most recent leaf that is (1) not equal to vid and (2)
** has not already been merged into vid and (3) the leaf is not
** closed and (4) the leaf is in the same branch as vid.
*/
int fossil_find_nearest_fork(int vid){
  return db_int(0,
    "SELECT leaf.rid"
    "  FROM leaf, event"
    " WHERE leaf.rid=event.objid"
    "   AND leaf.rid!=%d"                                /* Constraint (1) */
    "   AND leaf.rid NOT IN (SELECT merge FROM vmerge)"  /* Constraint (2) */
    "   AND NOT EXISTS(SELECT 1 FROM tagxref"            /* Constraint (3) */
                  "     WHERE rid=leaf.rid"
                  "       AND tagid=%d"
                  "       AND tagtype>0)"
    "   AND (SELECT value FROM tagxref"                  /* Constraint (4) */
          "   WHERE tagid=%d AND rid=%d AND tagtype>0) ="
          " (SELECT value FROM tagxref"
          "   WHERE tagid=%d AND rid=leaf.rid AND tagtype>0)"
    " ORDER BY event.mtime DESC LIMIT 1",
    vid, TAG_CLOSED, TAG_BRANCH, vid, TAG_BRANCH
  );
}

/*
** COMMAND: merge
**
** Usage: %fossil merge ?OPTIONS? ?VERSION?
**
** The argument VERSION is a version that should be merged into the
170
171
172
173
174
175
176
177

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
194
195
196
197
198
199
200

201
















202
203
204
205
206
207
208







-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







    ** the leaf is not closed and (4) the leaf is in the same branch
    ** as the current checkout.
    */
    Stmt q;
    if( pickFlag || backoutFlag || integrateFlag){
      fossil_fatal("cannot use --backout, --cherrypick or --integrate with a fork merge");
    }
    mid = db_int(0,
    mid = fossil_find_nearest_fork(vid);
      "SELECT leaf.rid"
      "  FROM leaf, event"
      " WHERE leaf.rid=event.objid"
      "   AND leaf.rid!=%d"                                /* Constraint (1) */
      "   AND leaf.rid NOT IN (SELECT merge FROM vmerge)"  /* Constraint (2) */
      "   AND NOT EXISTS(SELECT 1 FROM tagxref"            /* Constraint (3) */
                    "     WHERE rid=leaf.rid"
                    "       AND tagid=%d"
                    "       AND tagtype>0)"
      "   AND (SELECT value FROM tagxref"                  /* Constraint (4) */
            "   WHERE tagid=%d AND rid=%d AND tagtype>0) ="
            " (SELECT value FROM tagxref"
            "   WHERE tagid=%d AND rid=leaf.rid AND tagtype>0)"
      " ORDER BY event.mtime DESC LIMIT 1",
      vid, TAG_CLOSED, TAG_BRANCH, vid, TAG_BRANCH
    );
    if( mid==0 ){
      fossil_fatal("no unmerged forks of branch \"%s\"",
        db_text(0, "SELECT value FROM tagxref"
                   " WHERE tagid=%d AND rid=%d AND tagtype>0",
                   TAG_BRANCH, vid)
      );
    }
Changes to src/update.c.
119
120
121
122
123
124
125

126
127
128
129
130
131
132
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133







+







  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 ){
516
517
518
519
520
521
522
523

524
525
526

527
528
529
530
531
532
533
517
518
519
520
521
522
523

524
525
526

527
528
529
530
531
532
533
534







-
+


-
+







    free(zFullPath);
    free(zFullNewPath);
  }
  db_finalize(&q);
  db_finalize(&mtimeXfer);
  fossil_print("%.79c\n",'-');
  if( nUpdate==0 ){
    show_common_info(tid, "checkout:", 1, 0);
    isFork = 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);
    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 ){
558
559
560
561
562
563
564



565
566
567
568
569
570
571
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575







+
+
+







    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.
  */
  if( dryRunFlag ){
    db_end_transaction(1);  /* With --dry-run, rollback changes */