Fossil

Check-in [452f050241]
Login

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

Overview
Comment:On the header for a /timeline that uses the new to2= query parameter, use the value of either the to= or the to2= query parameter, whichever is valid.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 452f050241b94485b74d1b1f3c992e648b028383c65ccfe92b45ce3a7c77929a
User & Date: drh 2024-03-11 19:20:16.137
Context
2024-03-11
19:36
Update the change log. check-in: fc9c53abf1 user: drh tags: trunk
19:20
On the header for a /timeline that uses the new to2= query parameter, use the value of either the to= or the to2= query parameter, whichever is valid. check-in: 452f050241 user: drh tags: trunk
16:39
Disable load-control for the /xfer page. This prevents real users with passwords from being denied autosync because of some misbehaving spider. check-in: 650305e94f user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/name.c.
824
825
826
827
828
829
830



831
832
833
834
835
836
837
838



839
840
841
842
843
844
845

846
847
848
849
850
851
852

/*
** Try to resolve zQP1 into a check-in name.  If zQP1 does not exist,
** return 0.  If zQP1 exists but cannot be resolved, then also try to
** resolve zQP2 if it exists.  If zQP1 cannot be resolved but zQP2 does
** not exist, then raise an error.  If both zQP1 and zQP2 exists but
** neither can be resolved, also raise an error.



*/
int name_choice(const char *zQP1, const char *zQP2){
  const char *zName, *zName2;
  int rid;
  zName = P(zQP1);
  if( zName==0 || zName[0]==0 ) return 0;
  rid = symbolic_name_to_rid(zName, "ci");
  if( rid>0 ) return rid;



  if( rid<0 ){
    fossil_fatal("ambiguous name: %s", zName);
  }
  zName2 = P(zQP2);
  if( zName2==0 || zName2[0]==0 ){
    fossil_fatal("cannot resolve name: %s", zName);
  }

  return name_to_typed_rid(zName2, "ci");
}

/*
** WEBPAGE: ambiguous
** URL: /ambiguous?name=NAME&src=WEBPAGE
**







>
>
>

|





|
>
>
>







>







824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859

/*
** Try to resolve zQP1 into a check-in name.  If zQP1 does not exist,
** return 0.  If zQP1 exists but cannot be resolved, then also try to
** resolve zQP2 if it exists.  If zQP1 cannot be resolved but zQP2 does
** not exist, then raise an error.  If both zQP1 and zQP2 exists but
** neither can be resolved, also raise an error.
**
** If pzPick is not a NULL pointer, then *pzPick to be the value of whichever
** query parameter ended up being used.
*/
int name_choice(const char *zQP1, const char *zQP2, const char **pzPick){
  const char *zName, *zName2;
  int rid;
  zName = P(zQP1);
  if( zName==0 || zName[0]==0 ) return 0;
  rid = symbolic_name_to_rid(zName, "ci");
  if( rid>0 ){
    if( pzPick ) *pzPick = zName;
    return rid;
  }
  if( rid<0 ){
    fossil_fatal("ambiguous name: %s", zName);
  }
  zName2 = P(zQP2);
  if( zName2==0 || zName2[0]==0 ){
    fossil_fatal("cannot resolve name: %s", zName);
  }
  if( pzPick ) *pzPick = zName2;
  return name_to_typed_rid(zName2, "ci");
}

/*
** WEBPAGE: ambiguous
** URL: /ambiguous?name=NAME&src=WEBPAGE
**
Changes to src/timeline.c.
1836
1837
1838
1839
1840
1841
1842

1843
1844
1845
1846
1847
1848
1849
1850
  const char *zBisect = P("bid");    /* Bisect description */
  int cpOnly = PB("cherrypicks");    /* Show all cherrypick checkins */
  int tmFlags = 0;                   /* Timeline flags */
  const char *zThisTag = 0;          /* Suppress links to this tag */
  const char *zThisUser = 0;         /* Suppress links to this user */
  HQuery url;                        /* URL for various branch links */
  int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */

  int to_rid = name_choice("to","to2");             /* to= for path timelines */
  int noMerge = P("shortest")==0;           /* Follow merge links if shorter */
  int me_rid = name_to_typed_rid(P("me"),"ci");  /* me= for common ancestory */
  int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
  int pd_rid;
  double rBefore, rAfter, rCirca;     /* Boundary times */
  const char *z;
  char *zOlderButton = 0;             /* URL for Older button at the bottom */







>
|







1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
  const char *zBisect = P("bid");    /* Bisect description */
  int cpOnly = PB("cherrypicks");    /* Show all cherrypick checkins */
  int tmFlags = 0;                   /* Timeline flags */
  const char *zThisTag = 0;          /* Suppress links to this tag */
  const char *zThisUser = 0;         /* Suppress links to this user */
  HQuery url;                        /* URL for various branch links */
  int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
  const char *zTo2 = 0;
  int to_rid = name_choice("to","to2",&zTo2);    /* to= for path timelines */
  int noMerge = P("shortest")==0;           /* Follow merge links if shorter */
  int me_rid = name_to_typed_rid(P("me"),"ci");  /* me= for common ancestory */
  int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
  int pd_rid;
  double rBefore, rAfter, rCirca;     /* Boundary times */
  const char *z;
  char *zOlderButton = 0;             /* URL for Older button at the bottom */
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
        p = path_shortest(from_rid, to_rid, noMerge, 0, 0);
      }else if( from_to_mode==1 ){
        p = path_shortest(from_rid, to_rid, 0, 1, 0);
      }else{
        p = path_shortest(to_rid, from_rid, 0, 1, 0);
      }
      zFrom = P("from");
      zTo = P("to");
    }else{
      if( path_common_ancestor(me_rid, you_rid) ){
        p = path_first();
      }
      zFrom = P("me");
      zTo = P("you");
    }







|







2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
        p = path_shortest(from_rid, to_rid, noMerge, 0, 0);
      }else if( from_to_mode==1 ){
        p = path_shortest(from_rid, to_rid, 0, 1, 0);
      }else{
        p = path_shortest(to_rid, from_rid, 0, 1, 0);
      }
      zFrom = P("from");
      zTo = zTo2 ? zTo2 : P("to");
    }else{
      if( path_common_ancestor(me_rid, you_rid) ){
        p = path_first();
      }
      zFrom = P("me");
      zTo = P("you");
    }