Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch cx-db-handle-reorg Excluding Merge-Ins
This is equivalent to a diff from 9626c2acf6 to a67b757dc0
2021-12-31
| ||
21:33 | f-merge now defaults to wet-run mode. check-in: f3a4ba9472 user: stephan tags: trunk | |
21:30 | Extended fsl__cx_attach_role() to be able to create a new db if needed (required for fsl_repo_create()) but (regardless of this change) discovered that ATTACH, when run through the new fsl_cx::dbMain handle, can no longer create new db files, which means that f-open cannot create a checkout. COMPLETELY stumped as to why that is. Edit: closing because this branch is failing in inexplicable ways and has a horrid mix of branch-relevant and branch-irrelevant changes. Pulling in the branch-irrelevant ones separately into trunk before taking another whack at the branch-relevant ones. Closed-Leaf check-in: a67b757dc0 user: stephan tags: cx-db-handle-reorg | |
21:26 | Corrected recently-broken Makefile.in references in f-test-ciwoco. check-in: 6e8b5b6677 user: stephan tags: cx-db-handle-reorg | |
15:57 | Reorganized fsl_cx-internal DB handles, eliminating the in-memory/temp main db and (once again) using the first of the repo/checkout which is opened as the main db. Seems to work okay but some fallout would not be terribly surprising. (Edit: moving back to cx-db-handle-reorg because of new, inexplicable inability to create checkout db via ATTACH.) check-in: 46656edc7e user: stephan tags: cx-db-handle-reorg | |
13:47 | fsl_buffer_external() may now be passed a populated buffer, clearing it before re-initializing it. check-in: 9626c2acf6 user: stephan tags: trunk | |
2021-12-30
| ||
13:52 | Removed some debug output added by the previous checkin. check-in: 75eab853b5 user: stephan tags: trunk | |
Deleted bindings/Makefile.in.
| - - - - - - - - - - - - - - - - - - - |
|
Changes to bindings/s2/shell_extend.c.
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + + - - + + + + - - - - - - + + + + + + + + + + + | fsl_cx_err_reset(f); } va_end(vargs); return rc; } static int cb_toss_fsl( cwal_callback_args const * args, |
︙ | |||
319 320 321 322 323 324 325 | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | - - - - + - - + - - - - + + - - + | fsl_db * const db, bool addDtor, cwal_value **rv, fsl_dbrole_e role){ cwal_native * n; cwal_value * nv; int rc = 0; char const * fname = NULL; |
︙ | |||
1732 1733 1734 1735 1736 1737 1738 | 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 | - + + + + + - + - + | } } return rc; } /** |
︙ | |||
1812 1813 1814 1815 1816 1817 1818 | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | - + | : NULL; if(args->argc && (!dbName || !*dbName)){ return cb_toss(args, FSL_RC_MISUSE, "Expecting a non-empty string argument."); } rc = fsl_config_open( f, (dbName && *dbName) ? dbName : 0 ); if(rc){ |
︙ | |||
1841 1842 1843 1844 1845 1846 1847 | 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 | - + + - + - + + | : NULL; if(!dbName || !*dbName){ return cb_toss(args, FSL_RC_MISUSE, "Expecting a non-empty string argument."); } rc = fsl_repo_open( f, dbName ); if(rc){ |
︙ | |||
1947 1948 1949 1950 1951 1952 1953 | 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | - + | cwal_finalizer_f_fsl_cx, FSL_TYPEID(fsl_cx)); if(!v){ fsl_cx_finalize( f ); return CWAL_RC_OOM; } cwal_value_prototype_set( v, fsl_cx_prototype(se) ); |
︙ | |||
1978 1979 1980 1981 1982 1983 1984 | 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 | - + - + - - - - + - - - - - - + | cwal_native_clear(nat, 0); cwal_prop_unset(parent, dbName, dbNameLen); } } } static int cb_fsl_cx_close( cwal_callback_args const * args, |
︙ | |||
2067 2068 2069 2070 2071 2072 2073 | 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 | - + - + | if(rc){ /* Undecided: throw or return undefined if no entry found? */ #if 1 if(FSL_RC_NOT_FOUND==rc){ *rv = cwal_value_undefined(); rc = 0; }else{ |
︙ | |||
2124 2125 2126 2127 2128 2129 2130 | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 | - + | } } rc = (rid>0) ? fsl_content_get(f, rid, &fbuf) : fsl_content_get_sym(f, sym, &fbuf); if(rc){ assert(f->error.code); |
︙ | |||
2410 2411 2412 2413 2414 2415 2416 | 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 | - + | /* TODO: script mapping for fsl_satype_e values for 3nd arg. */ rc = sym ? fsl_deck_load_sym(f, &mf, sym, mfType) : fsl_deck_load_rid(f, &mf, rid, mfType) ; if(rc){ |
︙ | |||
2478 2479 2480 2481 2482 2483 2484 | 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 | - + - + - + | arg = args->argv[0]; if(cwal_value_is_integer(arg)){ rid1 = (fsl_id_t)cwal_value_get_integer(arg); }else if(!(sym = cwal_value_get_cstr(arg,NULL))){ goto misuse; }else{ rc = fsl_sym_to_rid(f, sym, FSL_SATYPE_ANY, &rid1); |
︙ |
Changes to bindings/s2/unit2/000-200-context.s2.
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - - + - + + + | assert 'Fossil' === typename Fossil; assert 'Db' === typename Fossil.Db; assert 'Stmt' === typename Fossil.Db.Stmt; assert 'Context' === typename Fossil.Context; scope { var f = new Fossil.Context({traceSql:false}); //print('f =',f); assert 'Context' === typename f; assert f inherits Fossil.Context; |
︙ |
Changes to f-apps/f-open.c.
︙ | |||
300 301 302 303 304 305 306 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | - + | if(!keep){ prev_ckout = 0; } else{ fsl_ckout_version_info(f, &prev_ckout, 0); } assert(dbRepo && dbRepo->dbh); if(!fsl_db_exists(dbRepo,"SELECT 1 FROM %s.event WHERE type='ci'", |
︙ |
Changes to f-apps/f-test-ciwoco.c.
︙ | |||
113 114 115 116 117 118 119 | 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 | - + - + - - + + | rc = setup_deck(&d, "Files added w/o checkout."); assert(0==rc); ////////////////////////////////////////////////////////////// // Step 3: add some files... char const * fnames[] = { "f-test-ciwoco.c", |
︙ |
Changes to include/fossil-scm/auth.h.
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + - + - + - + - + | returns a copy of zPw) if the project code is not set, under the assumption that this is "the first xfer request of a clone." Whether or not that will apply at this level to libfossil remains to be seen. TODO? Does fossil still use SHA1 for this? */ |
Changes to include/fossil-scm/checkout.h.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | SPDX-FileCopyrightText: 2021 The Libfossil Authors SPDX-ArtifactOfProjectName: Libfossil SPDX-FileType: Code Heavily indebted to the Fossil SCM project (https://fossil-scm.org). */ |
︙ | |||
2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 | 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | As of this writing, and for the foreseeable future, the list is comprised of only 3 elements, {".fslckout", "_FOSSIL_", NULL}, but the order of the non-NULL elements is unspecified by the interface. */ FSL_EXPORT char const ** fsl_ckout_dbnames(void); /** Tries to open a checked-out fossil repository db in the given directory. This routine canonicalizes its dirName argument using fsl_file_canonical_name(), then passes that and checkParentDirs on to fsl_ckout_db_search() to find a checkout db, so see that routine for how it searches. If dirName is NULL, "." is implied. If this routine finds/opens a checkout, it also tries to open the repository database from which the checkout derives, and fails if it cannot. The library never allows a checkout to be opened without its corresponding repository partner because a checkout has hard dependencies on the repo's state. Returns 0 on success. If there is an error opening or validating the checkout or its repository db, f's error state will be updated. Error codes/conditions include: - FSL_RC_MISUSE if f is NULL. - FSL_RC_ACCESS if f already has and opened checkout. - FSL_RC_OOM if an allocation fails. - FSL_RC_NOT_FOUND if no checkout is foud or if a checkout's repository is not found. - FSL_RC_RANGE if dirname is not NULL but has a length of 0. - Various codes from fsl_getcwd() (if dirName is NULL). - Various codes if opening the associated repository DB fails. TODO: there's really nothing in the architecture which restricts a checkout db to being in the same directory as the checkout, except for some historical bits which "could" be refactored. It "might be interesting" to eventually provide a variant which opens a checkout db file directly. We have the infrastructure, just need some refactoring. It "shouldn't" require any trickery or incompatibilities with fossil(1). */ FSL_EXPORT int fsl_ckout_open_dir( fsl_cx * const f, char const * dirName, bool checkParentDirs ); /** Searches the given directory (or the current directory if dirName is 0) for a fossil checkout database file named one of (_FOSSIL_, .fslckout). If it finds one, it returns 0 and appends the file's path to pOut if pOut is not 0. If neither is found AND if checkParentDirs is true an then it moves up the path one directory and tries again, until it hits the root of the dirPath (see below for a note/caveat). If dirName is NULL then it behaves as if it had been passed the absolute path of the current directory (as determined by fsl_getcwd()). This function does no normalization of dirName. Because of that... Achtung: if dirName is relative, this routine might not find a checkout where it would find one if given an absolute path (because it traverses the path string given it instead of its canonical form). Whether this is a bug or a feature is not yet clear. When in doubt, use fsl_file_canonical_name() to normalize the directory name before passing it in here. If it turns out that we always want that behaviour, this routine will be modified to canonicalize the name. This routine can return at least the following error codes: - FSL_RC_NOT_FOUND: either no checkout db was found or the given directory was not found. - FSL_RC_RANGE if dirName is an empty string. (We could arguably interpret this as a NULL string, i.e. the current directory.) - FSL_RC_OOM if allocation of a filename buffer fails. TODO? - Why was the decision made not to canonicalize dirName from here? We might want to change that. */ FSL_EXPORT int fsl_ckout_db_search( char const * dirName, bool checkParentDirs, fsl_buffer * const pOut ); /** If fsl_ckout_open_dir() (or similar) has been used to open a checkout db, this call closes that db. If an associated repository is also opened (as it should always be when a checkout is opened), it is necessarily closed by this operation because a checkout db is only valid with its associated repository. If no checkout is opened but a repository is, this function DOES NOT close that repository: use fsl_repo_close() or fsl_cx_close_dbs() to close it (noting that all dbs are implicitly closed by fsl_cx_finalize()). In the general case, fsl_repo_close() or fsl_cx_close_dbs(), instead of this routine, can be used to close a checkout db. Returns 0 on success or if no checkout db is opened. It may propagate an error from the db layer if closing/detaching the db fails. Returns FSL_RC_MISUSE if f has any transactions pending. Sidebar: this is NOT related to fossil(1)'s "close" feature, which "closes" a checkout by deleting the checkout database. @see fsl_ckout_open() @see fsl_repo_close() @see fsl_cx_close_dbs() */ FSL_EXPORT int fsl_ckout_close( fsl_cx * const f ); #if defined(__cplusplus) } /*extern "C"*/ #endif #endif /* ORG_FOSSIL_SCM_FSL_CHECKOUT_H_INCLUDED */ |
Changes to include/fossil-scm/cli.h.
︙ | |||
523 524 525 526 527 528 529 | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | - - - - - - - - - - | fcli_cx() returns the API's fsl_cx instance. It will be non-NULL (but might not have an opened checkout/repository) if fsl_setup() succeeds. */ FSL_EXPORT fcli_t fcli; |
︙ |
Changes to include/fossil-scm/confdb.h.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | SPDX-License-Identifier: BSD-2-Clause-FreeBSD SPDX-FileCopyrightText: 2021 The Libfossil Authors SPDX-ArtifactOfProjectName: Libfossil SPDX-FileType: Code Heavily indebted to the Fossil SCM project (https://fossil-scm.org). */ |
︙ |
Changes to include/fossil-scm/core.h.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | SPDX-FileCopyrightText: 2021 The Libfossil Authors SPDX-ArtifactOfProjectName: Libfossil SPDX-FileType: Code Heavily indebted to the Fossil SCM project (https://fossil-scm.org). */ |
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + | fsl_cx_db_repo() and fsl_cx_db_ckout() will always return the same database handle, but they can tell whether a given role has been attached or not and will fail in their documented ways when the role's corresponding database has not yet been attached. e.g. `fsl_cx_db_repo()` will return `NULL` if a repo database is not attached. |
︙ | |||
945 946 947 948 949 950 951 | 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | FSL_EXPORT int fsl_outputf( fsl_cx * const f, char const * fmt, ... ); /** va_list counterpart to fsl_outputf(). */ FSL_EXPORT int fsl_outputfv( fsl_cx * const f, char const * fmt, va_list args ); |
︙ | |||
1047 1048 1049 1050 1051 1052 1053 | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | default user name set. The returned bytes are owned by f and will be invalidated by any future calls to fsl_cx_user_set(). @see fsl_cx_user_guess() */ FSL_EXPORT char const * fsl_cx_user_get( fsl_cx const * const f ); |
︙ | |||
1380 1381 1382 1383 1384 1385 1386 | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | Note that the role of FSL_DBROLE_TEMP is invalid here. */ FSL_EXPORT char const * fsl_cx_db_file_for_role(fsl_cx const * f, fsl_dbrole_e r, fsl_size_t * len); |
︙ | |||
1431 1432 1433 1434 1435 1436 1437 | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | - + - - - - - + + + + + + + + + + + + | */ FSL_EXPORT char const * fsl_cx_ckout_dir_name(fsl_cx const * f, fsl_size_t * len); /** Returns a handle to f's main db (which may or may not have any relationship to the repo/checkout/config databases - that's |
︙ | |||
1562 1563 1564 1565 1566 1567 1568 | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | - + | FSL_EXPORT void fsl_config_close( fsl_cx * const f ); /** If f has an opened configuration db then its handle is returned, else 0 is returned. For API consistency's sake, the db handle's "MAIN" name is aliased |
︙ | |||
2028 2029 2030 2031 2032 2033 2034 | 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 | - + + - + + | fsl_db_transaction_level(), or 0 if f has no db opened. @see fsl_cx_db() */ FSL_EXPORT int fsl_cx_transaction_level(fsl_cx * const f); /** Returns the same as passing fsl_cx_db() to |
︙ |
Changes to include/fossil-scm/db.h.
︙ | |||
1549 1550 1551 1552 1553 1554 1555 | 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | - + + + | */ FSL_EXPORT int fsl_db_open( fsl_db * const db, char const * dbFile, int openFlags ); /** Closes the given db handle and frees any resources owned by db. Results are undefined if db is NULL. If db is not opened, |
︙ | |||
1610 1611 1612 1613 1614 1615 1616 | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 | - + - | /** Returns a db name string for the given fsl_db_role value. The string is static, guaranteed to live as long as the app. It returns NULL (or asserts in debug builds) if passed FSL_DBROLE_NONE or some value out of range for the enum. */ |
︙ |
Added include/fossil-scm/deprecated.h.