You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2022/03/15 13:42:48 UTC

svn commit: r1898948 - in /subversion/branches/pristines-on-demand-issue4892: ./ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_wc/

Author: julianfoad
Date: Tue Mar 15 13:42:47 2022
New Revision: 1898948

URL: http://svn.apache.org/viewvc?rev=1898948&view=rev
Log:
New branch 'pristines-on-demand-on-issue4892': update fetches minimal pristines.

Branched from 'pristines-on-demand-on-mwf'. This commit, as well as
branching, applies the proof-of-concept patch sent to dev@ thread "Issue
#525/#4892: on only fetching the pristines we really need".

This is a proof-of-concept patch, enabling "update" to fetch minimal
pristines, using a deeper callback to fetch them at the point of use.

Currently, "restore" functionality of the update is disabled. A similar
approach could enable it to fetch at point of use as well. Currently it
being disabled leads to the following test suite failures:

  FAIL:  basic_tests.py 1: basic checkout of a wc
  FAIL:  copy_tests.py 20: copy over a missing file
  FAIL:  relocate_tests.py 1: relocate with deleted, missing and copied entries
  FAIL:  stat_tests.py 13: timestamp behaviour
  FAIL:  update_tests.py 6: delete files and update to resolve text conflicts
  FAIL:  update_tests.py 9: update missing items (by name) in working copy
  FAIL:  update_tests.py 14: update missing dir to rev in which it is absent
  FAIL:  update_tests.py 15: another "hudson" problem: updates that delete
  FAIL:  upgrade_tests.py 24: test upgrading a working copy with missing subdir
  FAIL:  upgrade_tests.py 27: upgrade with missing replaced dir

This patch leads to one additional test failure:

  FAIL:  externals_tests.py 68: check file external recorded info

* subversion/include/private/svn_wc_private.h
  (svn_wc__textbase_hydrate_cb_t): Moved to earlier.
  (svn_wc__get_update_editor): Add a hydrate callback.
  (svn_wc__crawl_revisions6): New, bumped... ### see below.

* subversion/libsvn_client/client.h,
  subversion/libsvn_client/textbase.c
  (svn_client__textbase_get_hydrator): New.

* subversion/libsvn_client/switch.c
  (svn_client__switch_internal): ### hydrate before conflicts resolver

* subversion/libsvn_client/update.c
  (update_internal): 
  (svn_client__update_internal): Don't hydrate everything at the start.
    Pass a hydrate callback down to the WC update operation. 
    ### TODO/TO-CHECK: Also hydrate before conflicts resolver.

* subversion/libsvn_wc/adm_crawler.c
  (maybe_restore_node): ### TEMPORARY: don't restore.
  (svn_wc_crawl_revisions5): Bump to ...6(), adding a hydrate callback.
    ### TODO: use the callback for "restore".

* subversion/libsvn_wc/deprecated.c
  (svn_wc_get_update_editor4): Pass null for hydrate callback.

* subversion/libsvn_wc/update_editor.c
  (lazy_open_source): Use a hydrate callback to hydrate if pristine is
    missing.
  (edit_baton,
   make_editor,
   svn_wc__get_update_editor,
   svn_wc__get_switch_editor): Pass a hydrate callback through.

* subversion/libsvn_wc/wc_db.h,
  subversion/libsvn_wc/wc_db_textbase.c
  (svn_wc__db_textbase_hydrate): Newly public; renamed ...
  (textbase_hydrate): ... from this.
  (svn_wc__db_textbase_sync): Track the rename.

Added:
    subversion/branches/pristines-on-demand-issue4892/   (props changed)
      - copied from r1898947, subversion/branches/pristines-on-demand-on-mwf/
Modified:
    subversion/branches/pristines-on-demand-issue4892/subversion/include/private/svn_wc_private.h
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/client.h
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/switch.c
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/textbase.c
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/update.c
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/adm_crawler.c
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/deprecated.c
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/update_editor.c
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db.h
    subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db_textbase.c

Propchange: subversion/branches/pristines-on-demand-issue4892/
------------------------------------------------------------------------------
--- svn:auto-props (added)
+++ svn:auto-props Tue Mar 15 13:42:47 2022
@@ -0,0 +1,14 @@
+*.c = svn:eol-style=native
+*.cpp = svn:eol-style=native
+*.h = svn:eol-style=native
+*.hpp = svn:eol-style=native
+*.java = svn:eol-style=native
+*.m4 = svn:eol-style=native
+*.py = svn:eol-style=native
+*.pl = svn:eol-style=native
+*.rb = svn:eol-style=native
+*.sql = svn:eol-style=native
+*.txt = svn:eol-style=native
+README = svn:eol-style=native
+BRANCH-README = svn:eol-style=native
+STATUS = svn:eol-style=native

Propchange: subversion/branches/pristines-on-demand-issue4892/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 15 13:42:47 2022
@@ -0,0 +1,65 @@
+ChangeLog*
+Makefile
+config.cache
+config.log
+config.nice
+config.status
+configure
+libtool
+.gdb_history
+.swig_checked
+*.orig
+*.rej
+TAGS
+tags
+neon
+build-outputs.mk
+aclocal.m4
+autogen-standalone.mk
+autom4te.cache
+gen-make.opts
+tests.log*
+fails.log*
+db4-win32
+db
+*.o
+*~
+.*~
+apr
+apr-util
+apr-iconv
+Release
+release_win32
+release_win32_static
+release_x64
+Debug
+debug_win32
+debug_win32_static
+debug_x64
+ipch
+subversion_msvc.dsw
+subversion_msvc.ncb
+subversion_msvc.opt
+subversion_msvc.plg
+subversion_vcnet.*
+mkmf.log
+.project
+.classpath
+.cdtproject
+.settings
+.cproject
+py3c
+zlib
+sqlite-amalgamation
+serf
+googlemock
+.git
+.gitignore
+.idea
+compile_commands.json
+.kdev4
+*.kdev4
+.vs
+.swig_pl_checked
+.swig_py_checked
+.swig_rb_checked

Propchange: subversion/branches/pristines-on-demand-issue4892/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Mar 15 13:42:47 2022
@@ -0,0 +1,111 @@
+/subversion/branches/1.10-cache-improvements:1669168-1694487
+/subversion/branches/1.11.x:1841316,1841548
+/subversion/branches/1.5.x-r30215:870312
+/subversion/branches/1.7.x-fs-verify:1146708,1161180
+/subversion/branches/1.9-cache-improvements:1678948-1679863
+/subversion/branches/1.9.x:1735680
+/subversion/branches/10Gb:1388102,1388163-1388190,1388195,1388202,1388205,1388211,1388276,1388362,1388375,1388394,1388636,1388639-1388640,1388643-1388644,1388654,1388720,1388789,1388795,1388801,1388805,1388807,1388810,1388816,1389044,1389276,1389289,1389662,1389867,1390017,1390209,1390216,1390407,1390409,1390414,1390419,1390955
+/subversion/branches/atomic-revprop:965046-1000689
+/subversion/branches/authzperf:1613053-1776831
+/subversion/branches/auto-props-sdc:1384106-1401643
+/subversion/branches/bdb-reverse-deltas:872050-872529
+/subversion/branches/cache-server:1458643-1476567
+/subversion/branches/decouple-shelving-cli:1874630-1875035
+/subversion/branches/diff-callbacks3:870059-870761
+/subversion/branches/diff-optimizations:1031270-1037352
+/subversion/branches/diff-optimizations-bytes:1037353-1067789
+/subversion/branches/dont-save-plaintext-passwords-by-default:870728-871118
+/subversion/branches/double-delete:870511-872970
+/subversion/branches/dump-load-cross-check:1654853-1657295
+/subversion/branches/ev2-export:1325914,1332738,1413107
+/subversion/branches/explore-wc:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
+/subversion/branches/file-externals:871779-873302
+/subversion/branches/fs-rep-sharing:869036-873803
+/subversion/branches/fsfs-format7:1426304,1430673,1433848,1438408,1438982,1441129,1442051,1442068,1442504,1442910,1443171,1443803,1444690,1444693,1444695,1445040,1445080,1446103,1451129,1453590,1454307,1460579,1461851,1461865,1462837,1462904,1463120,1467362,1467382,1469487,1471208,1477166,1478055,1481447,1489817,1489949,1490673-1490674,1491784,1493042,1498029,1498103,1498155,1500054,1507729-1507731,1507735-1507736
+/subversion/branches/fsfs-improvements:1499981-1547039
+/subversion/branches/fsfs-lock-many:1571740-1577217
+/subversion/branches/fsfs-pack:873717-874575
+/subversion/branches/fsx:1507845-1509914
+/subversion/branches/fsx-1.10:1658219-1694500
+/subversion/branches/fsx-id:1645603-1649011
+/subversion/branches/gnome-keyring:870558-871410
+/subversion/branches/gpg-agent-password-store:1005036-1150766
+/subversion/branches/gtest_addition:1452117-1502138
+/subversion/branches/http-protocol-v2:874395-876041
+/subversion/branches/in-memory-cache:869829-871452
+/subversion/branches/in-repo-authz:1414342-1424779
+/subversion/branches/inheritable-props:1297080-1395089
+/subversion/branches/integrate-cache-item-serialization:1068724-1068739
+/subversion/branches/integrate-cache-membuffer:998649-998852
+/subversion/branches/integrate-compression-level:1068651-1072287
+/subversion/branches/integrate-io-improvements:1068684-1072297
+/subversion/branches/integrate-is-cachable:1072568-1074082
+/subversion/branches/integrate-partial-getter:1072558-1076552
+/subversion/branches/integrate-readline-speedup:1072553-1072555
+/subversion/branches/integrate-stream-api-extensions:1068695-1072516
+/subversion/branches/integrate-string-improvements:1068251-1190617
+/subversion/branches/integrate-txdelta-caching:1072541-1078213
+/subversion/branches/issue-2779-dev:965496-984198
+/subversion/branches/issue-2843-dev:871432-874179
+/subversion/branches/issue-3000:871713,871716-871719,871721-871726,871728,871734
+/subversion/branches/issue-3067-deleted-subtrees:873375-874084
+/subversion/branches/issue-3148-dev:875193-875204
+/subversion/branches/issue-3220-dev:872210-872226
+/subversion/branches/issue-3242-dev:879653-896436
+/subversion/branches/issue-3334-dirs:875156-875867
+/subversion/branches/issue-3975:1152931-1160746
+/subversion/branches/issue-4116-dev:1424719-1425040
+/subversion/branches/issue-4194-dev:1410507-1414880
+/subversion/branches/issue-4869:1885862-1885981
+/subversion/branches/java10-compat:1840620-1841179
+/subversion/branches/javahl-1.14-fixes:1882126-1886028
+/subversion/branches/javahl-ra:991978-1494640
+/subversion/branches/kwallet:870785-871314
+/subversion/branches/log-addressing:1509279-1546844
+/subversion/branches/log-g-performance:870941-871032
+/subversion/branches/merge-skips-obstructions:874525-874615
+/subversion/branches/move-tracking-2:1606692-1714632
+/subversion/branches/multi-layer-moves:1239019-1300930
+/subversion/branches/multi-wc-format:1897945-1898186
+/subversion/branches/nfc-nfd-aware-client:870276,870376
+/subversion/branches/node_pool:1304828-1305388
+/subversion/branches/patch-exec:1692717-1705390
+/subversion/branches/performance:979193,980118,981087,981090,981189,981194,981287,981684,981827,982043,982355,983398,983406,983430,983474,983488,983490,983760,983764,983766,983770,984927,984973,984984,985014,985037,985046,985472,985477,985482,985487-985488,985493,985497,985500,985514,985601,985603,985606,985669,985673,985695,985697,986453,986465,986485,986491-986492,986517,986521,986605,986608,986817,986832,987865,987868-987869,987872,987886-987888,987893,988319,988898,990330,990533,990535-990537,990541,990568,990572,990574-990575,990600,990759,992899,992904,992911,993127,993141,994956,995478,995507,995603,998012,998858,999098,1001413,1001417,1004291,1022668,1022670,1022676,1022715,1022719,1025660,1025672,1027193,1027203,1027206,1027214,1027227,1028077,1028092,1028094,1028104,1028107,1028111,1028354,1029038,1029042-1029043,1029054-1029055,1029062-1029063,1029078,1029080,1029090,1029092-1029093,1029111,1029151,1029158,1029229-1029230,1029232,1029335-1029336,1029339-1029340,1029342,10
 29344,1030763,1030827,1031203,1031235,1032285,1032333,1033040,1033057,1033294,1035869,1035882,1039511,1043705,1053735,1056015,1066452,1067683,1067697-1078365
+/subversion/branches/pin-externals:1643757-1659392
+/subversion/branches/pristines-on-demand:1892643-1897945
+/subversion/branches/py-tests-as-modules:956579-1033052
+/subversion/branches/ra-svn-tuning:1658201-1694489
+/subversion/branches/ra_serf-digest-authn:875693-876404
+/subversion/branches/reintegrate-improvements:873853-874164
+/subversion/branches/remote-only-status:1581845-1586090
+/subversion/branches/resolve-incoming-add:1762797-1764284
+/subversion/branches/revprop-cache:1298521-1326293
+/subversion/branches/revprop-caching-ng:1620597,1620599
+/subversion/branches/revprop-packing:1143907,1143971,1143997,1144017,1144499,1144568,1146145
+/subversion/branches/shelve:1802592-1815226
+/subversion/branches/shelve-checkpoint:1801593-1801923,1801970,1817320,1828508,1828521
+/subversion/branches/shelving-v3:1853394-1853901
+/subversion/branches/subtree-mergeinfo:876734-878766
+/subversion/branches/svn-auth-x509:1603509-1655900
+/subversion/branches/svn-info-detail:1660035-1662618
+/subversion/branches/svn-mergeinfo-enhancements:870119-870195,870197-870288
+/subversion/branches/svn-mergeinfo-normalizer:1642232-1695991
+/subversion/branches/svn-patch-improvements:918519-934609
+/subversion/branches/svn_mutex:1141683-1182099
+/subversion/branches/svnpatch-diff:865738-876477
+/subversion/branches/svnraisetc:874709-875149
+/subversion/branches/svnserve-logging:869828-870893
+/subversion/branches/swig-py3:1813660-1869353
+/subversion/branches/tc-issue-3334:874697-874773
+/subversion/branches/tc-merge-notify:874017-874062
+/subversion/branches/tc-resolve:874191-874239
+/subversion/branches/tc_url_rev:874351-874483
+/subversion/branches/tree-conflicts:868291-873154
+/subversion/branches/tree-conflicts-notify:873926-874008
+/subversion/branches/tristate-chunked-request:1502394-1502681
+/subversion/branches/tweak-build-take-two:1424288-1425049,1425051-1425613
+/subversion/branches/uris-as-urls:1060426-1064427
+/subversion/branches/verify-at-commit:1462039-1462408
+/subversion/branches/verify-keep-going:1439280-1546110
+/subversion/branches/wc-collate-path:1402685-1480384
+/subversion/trunk:1807118-1898849

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/include/private/svn_wc_private.h?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/include/private/svn_wc_private.h Tue Mar 15 13:42:47 2022
@@ -47,6 +47,18 @@ extern "C" {
 #endif /* __cplusplus */
 
 
+/* The callback invoked by svn_wc__textbase_sync() to fetch the text-base
+   contents identified by REPOS_ROOT_URL, REPOS_RELPATH and REVISION. */
+typedef svn_error_t *(*svn_wc__textbase_hydrate_cb_t)(
+  void *baton,
+  const char *repos_root_url,
+  const char *repos_relpath,
+  svn_revnum_t revision,
+  svn_stream_t *contents,
+  svn_cancel_func_t cancel_func,
+  void *cancel_baton,
+  apr_pool_t *scratch_pool);
+
 /* Return TRUE iff CLHASH (a hash whose keys are const char *
    changelist names) is NULL or if LOCAL_ABSPATH is part of a changelist in
    CLHASH. */
@@ -1523,6 +1535,8 @@ svn_wc__get_update_editor(const svn_delt
                           svn_boolean_t clean_checkout,
                           const char *diff3_cmd,
                           const apr_array_header_t *preserved_exts,
+                          svn_wc__textbase_hydrate_cb_t hydrate_func,
+                          void *hydrate_baton,
                           svn_wc_dirents_func_t fetch_dirents_func,
                           void *fetch_dirents_baton,
                           svn_wc_conflict_resolver_func2_t conflict_func,
@@ -2314,18 +2328,6 @@ svn_wc__upgrade(svn_wc_context_t *wc_ctx
                 void *notify_baton,
                 apr_pool_t *scratch_pool);
 
-/* The callback invoked by svn_wc__textbase_sync() to fetch the text-base
-   contents identified by REPOS_ROOT_URL, REPOS_RELPATH and REVISION. */
-typedef svn_error_t *(*svn_wc__textbase_hydrate_cb_t)(
-  void *baton,
-  const char *repos_root_url,
-  const char *repos_relpath,
-  svn_revnum_t revision,
-  svn_stream_t *contents,
-  svn_cancel_func_t cancel_func,
-  void *cancel_baton,
-  apr_pool_t *scratch_pool);
-
 /* Synchronize the state of the text-base contents for the LOCAL_ABSPATH tree.
    If ALLOW_HYDRATE is true, fetch the required but missing text-base contents
    using the provided HYDRATE_CALLBACK and HYDRATE_BATON.  If ALLOW_DEHYDRATE
@@ -2341,6 +2343,27 @@ svn_wc__textbase_sync(svn_wc_context_t *
                       void *cancel_baton,
                       apr_pool_t *scratch_pool);
 
+/**
+ * @since New in 1.15.
+ */
+svn_error_t *
+svn_wc__crawl_revisions6(svn_wc_context_t *wc_ctx,
+                         const char *local_abspath,
+                         const svn_ra_reporter3_t *reporter,
+                         void *report_baton,
+                         svn_boolean_t restore_files,
+                         svn_depth_t depth,
+                         svn_boolean_t honor_depth_exclude,
+                         svn_boolean_t depth_compatibility_trick,
+                         svn_boolean_t use_commit_times,
+                         svn_wc__textbase_hydrate_cb_t hydrate_func,
+                         void *hydrate_baton,
+                         svn_cancel_func_t cancel_func,
+                         void *cancel_baton,
+                         svn_wc_notify_func2_t notify_func,
+                         void *notify_baton,
+                         apr_pool_t *scratch_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/client.h?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/client.h (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/client.h Tue Mar 15 13:42:47 2022
@@ -40,6 +40,7 @@
 #include "private/svn_client_private.h"
 #include "private/svn_diff_tree.h"
 #include "private/svn_editor.h"
+#include "private/svn_wc_private.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -1251,6 +1252,17 @@ svn_client__textbase_sync(const char *lo
                           svn_client_ctx_t *ctx,
                           apr_pool_t *scratch_pool);
 
+/* ...
+ *
+ * RA_SESSION may be null; in that case, it will open a new session upon
+ * first use. */
+svn_error_t *
+svn_client__textbase_get_hydrator(svn_wc__textbase_hydrate_cb_t *hydrate_func,
+                                  void **hydrate_baton,
+                                  svn_ra_session_t *ra_session,
+                                  svn_client_ctx_t *ctx,
+                                  apr_pool_t *result_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/switch.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/switch.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/switch.c Tue Mar 15 13:42:47 2022
@@ -442,6 +442,9 @@ svn_client__switch_internal(svn_revnum_t
    * resolve any conflicts that were raised. */
   if (! err1 && ctx->conflict_func2)
     {
+      SVN_ERR(svn_client__textbase_sync(local_abspath, TRUE, TRUE,
+                                        ctx, pool));
+
       err1 = svn_client__resolve_conflicts(NULL, conflicted_paths, ctx, pool);
     }
 

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/textbase.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/textbase.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/textbase.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/textbase.c Tue Mar 15 13:42:47 2022
@@ -85,6 +85,24 @@ textbase_hydrate_cb(void *baton,
 }
 
 svn_error_t *
+svn_client__textbase_get_hydrator(svn_wc__textbase_hydrate_cb_t *hydrate_func,
+                                  void **hydrate_baton,
+                                  svn_ra_session_t *ra_session,
+                                  svn_client_ctx_t *ctx,
+                                  apr_pool_t *result_pool)
+{
+  textbase_hydrate_baton_t *baton = apr_pcalloc(result_pool, sizeof(*baton));
+
+  baton->pool = result_pool;
+  baton->ctx = ctx;
+  baton->ra_session = ra_session;
+
+  *hydrate_func = textbase_hydrate_cb;
+  *hydrate_baton = baton;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_client__textbase_sync(const char *local_abspath,
                           svn_boolean_t allow_hydrate,
                           svn_boolean_t allow_dehydrate,
@@ -99,6 +117,7 @@ svn_client__textbase_sync(const char *lo
   baton.ctx = ctx;
   baton.ra_session = NULL;
 
+  SVN_DBG(("svn_client__textbase_sync(%d,%d)", allow_hydrate, allow_dehydrate));
   SVN_ERR(svn_wc__textbase_sync(ctx->wc_ctx, local_abspath,
                                 allow_hydrate, allow_dehydrate,
                                 textbase_hydrate_cb, &baton,

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/update.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/update.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_client/update.c Tue Mar 15 13:42:47 2022
@@ -327,6 +327,8 @@ update_internal(svn_revnum_t *result_rev
   svn_config_t *cfg = ctx->config
                       ? svn_hash_gets(ctx->config, SVN_CONFIG_CATEGORY_CONFIG)
                       : NULL;
+  svn_wc__textbase_hydrate_cb_t hydrate_func;
+  void *hydrate_baton;
 
   if (result_rev)
     *result_rev = SVN_INVALID_REVNUM;
@@ -467,7 +469,7 @@ update_internal(svn_revnum_t *result_rev
       ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
     }
 
-  SVN_ERR(svn_client__textbase_sync(local_abspath, TRUE, TRUE,
+  SVN_ERR(svn_client__textbase_sync(local_abspath, FALSE, TRUE,
                                     ctx, scratch_pool));
 
   SVN_ERR(reuse_ra_session(ra_session_p, &corrected_url, anchor_url,
@@ -497,6 +499,10 @@ update_internal(svn_revnum_t *result_rev
       anchor_url = corrected_url;
     }
 
+  SVN_ERR(svn_client__textbase_get_hydrator(&hydrate_func, &hydrate_baton,
+                                            NULL /*hydrate_ra_session*/,
+                                            ctx, scratch_pool));
+
   /* Resolve unspecified REVISION now, because we need to retrieve the
      correct inherited props prior to the editor drive and we need to
      use the same value of HEAD for both. */
@@ -533,6 +539,7 @@ update_internal(svn_revnum_t *result_rev
                                     server_supports_depth,
                                     clean_checkout,
                                     diff3_cmd, preserved_exts,
+                                    hydrate_func, hydrate_baton,
                                     svn_client__dirent_fetcher, &dfb,
                                     conflicted_paths ? record_conflict : NULL,
                                     conflicted_paths,
@@ -560,14 +567,15 @@ update_internal(svn_revnum_t *result_rev
   /* Drive the reporter structure, describing the revisions within
      LOCAL_ABSPATH.  When this calls reporter->finish_report, the
      reporter will drive the update_editor. */
-  SVN_ERR(svn_wc_crawl_revisions5(ctx->wc_ctx, local_abspath, reporter,
-                                  report_baton, TRUE,
-                                  depth, (! depth_is_sticky),
-                                  (! server_supports_depth),
-                                  use_commit_times,
-                                  ctx->cancel_func, ctx->cancel_baton,
-                                  ctx->notify_func2, ctx->notify_baton2,
-                                  scratch_pool));
+  SVN_ERR(svn_wc__crawl_revisions6(ctx->wc_ctx, local_abspath, reporter,
+                                   report_baton, TRUE,
+                                   depth, (! depth_is_sticky),
+                                   (! server_supports_depth),
+                                   use_commit_times,
+                                   hydrate_func, hydrate_baton,
+                                   ctx->cancel_func, ctx->cancel_baton,
+                                   ctx->notify_func2, ctx->notify_baton2,
+                                   scratch_pool));
 
   /* We handle externals after the update is complete, so that
      handling external items (and any errors therefrom) doesn't delay
@@ -711,6 +719,9 @@ svn_client__update_internal(svn_revnum_t
    * resolve any conflicts that were raised. */
   if (! err && ctx->conflict_func2 && apr_hash_count(conflicted_paths))
     {
+      SVN_ERR(svn_client__textbase_sync(local_abspath, TRUE, TRUE,
+                                        ctx, pool));
+
       err = svn_client__resolve_conflicts(NULL, conflicted_paths, ctx, pool);
     }
 

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/adm_crawler.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/adm_crawler.c Tue Mar 15 13:42:47 2022
@@ -209,11 +209,17 @@ maybe_restore_node(svn_wc__db_t *db,
 
       if (dirent_kind == svn_node_none)
         {
-          SVN_ERR(restore_node(db, local_abspath,
+  return SVN_NO_ERROR;
+          err = (restore_node(db, local_abspath,
                                wrk_kind, conflicted, use_commit_times,
                                cancel_func, cancel_baton,
                                notify_func, notify_baton,
                                scratch_pool));
+          if (err)
+            {
+              svn_handle_warning2(stdout, err, "DBG: ");
+              svn_error_clear(err);
+            }
         }
     }
 
@@ -675,20 +681,22 @@ report_revisions_and_depths(svn_wc__db_t
 
 
 svn_error_t *
-svn_wc_crawl_revisions5(svn_wc_context_t *wc_ctx,
-                        const char *local_abspath,
-                        const svn_ra_reporter3_t *reporter,
-                        void *report_baton,
-                        svn_boolean_t restore_files,
-                        svn_depth_t depth,
-                        svn_boolean_t honor_depth_exclude,
-                        svn_boolean_t depth_compatibility_trick,
-                        svn_boolean_t use_commit_times,
-                        svn_cancel_func_t cancel_func,
-                        void *cancel_baton,
-                        svn_wc_notify_func2_t notify_func,
-                        void *notify_baton,
-                        apr_pool_t *scratch_pool)
+svn_wc__crawl_revisions6(svn_wc_context_t *wc_ctx,
+                         const char *local_abspath,
+                         const svn_ra_reporter3_t *reporter,
+                         void *report_baton,
+                         svn_boolean_t restore_files,
+                         svn_depth_t depth,
+                         svn_boolean_t honor_depth_exclude,
+                         svn_boolean_t depth_compatibility_trick,
+                         svn_boolean_t use_commit_times,
+                         svn_wc__textbase_hydrate_cb_t hydrate_func,
+                         void *hydrate_baton,
+                         svn_cancel_func_t cancel_func,
+                         void *cancel_baton,
+                         svn_wc_notify_func2_t notify_func,
+                         void *notify_baton,
+                         apr_pool_t *scratch_pool)
 {
   svn_wc__db_t *db = wc_ctx->db;
   svn_error_t *fserr, *err;
@@ -877,6 +885,36 @@ svn_wc_crawl_revisions5(svn_wc_context_t
   return svn_error_trace(err);
 }
 
+svn_error_t *
+svn_wc_crawl_revisions5(svn_wc_context_t *wc_ctx,
+                        const char *local_abspath,
+                        const svn_ra_reporter3_t *reporter,
+                        void *report_baton,
+                        svn_boolean_t restore_files,
+                        svn_depth_t depth,
+                        svn_boolean_t honor_depth_exclude,
+                        svn_boolean_t depth_compatibility_trick,
+                        svn_boolean_t use_commit_times,
+                        svn_cancel_func_t cancel_func,
+                        void *cancel_baton,
+                        svn_wc_notify_func2_t notify_func,
+                        void *notify_baton,
+                        apr_pool_t *scratch_pool)
+{
+  SVN_ERR(svn_wc__crawl_revisions6(wc_ctx, local_abspath,
+                                   reporter, report_baton,
+                                   restore_files,
+                                   depth,
+                                   honor_depth_exclude,
+                                   depth_compatibility_trick,
+                                   use_commit_times,
+                                   NULL, NULL,
+                                   cancel_func, cancel_baton,
+                                   notify_func, notify_baton,
+                                   scratch_pool));
+  return SVN_NO_ERROR;
+}
+
 /*** Copying stream ***/
 
 /* A copying stream is a bit like the unix tee utility:

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/deprecated.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/deprecated.c Tue Mar 15 13:42:47 2022
@@ -3643,6 +3643,7 @@ svn_wc_get_update_editor4(const svn_delt
                               clean_checkout,
                               diff3_cmd,
                               preserved_exts,
+                              NULL, NULL, /* hydrate func/baton */
                               fetch_dirents_func, fetch_dirents_baton,
                               conflict_func, conflict_baton,
                               external_func, external_baton,

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/update_editor.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/update_editor.c Tue Mar 15 13:42:47 2022
@@ -244,6 +244,10 @@ struct edit_baton
   svn_wc_conflict_resolver_func2_t conflict_func;
   void *conflict_baton;
 
+  /* Hydrate callback... */
+  svn_wc__textbase_hydrate_cb_t hydrate_func;
+  void *hydrate_baton;
+
   /* Subtrees that were skipped during the edit, and therefore shouldn't
      have their revision/url info updated at the end.  If a path is a
      directory, its descendants will also be skipped.  The keys are paths
@@ -3743,12 +3747,27 @@ lazy_open_source(svn_stream_t **stream,
                  apr_pool_t *scratch_pool)
 {
   struct file_baton *fb = baton;
+  struct edit_baton *eb = fb->edit_baton;
 
-  SVN_ERR(svn_wc__textbase_get_contents(stream, fb->edit_baton->db,
-                                        fb->local_abspath,
-                                        fb->original_checksum, FALSE,
+  SVN_ERR(svn_wc__textbase_get_contents(stream, eb->db, fb->local_abspath,
+                                        fb->original_checksum, TRUE,
                                         result_pool, scratch_pool));
-
+  /* If the pristine was missing, hydrate it and then try again. */
+  /* (### Alternative: If pristine was missing, try to pull it from the repo
+   * via a callback. But we don't have a repo pull function available.) */
+  if (! *stream)
+    {
+      SVN_ERR(svn_wc__db_textbase_hydrate(eb->db, fb->local_abspath,
+                                          eb->hydrate_func, eb->hydrate_baton,
+                                          eb->cancel_func, eb->cancel_baton,
+                                          fb->original_checksum,
+                                          eb->repos_root, fb->new_repos_relpath,
+                                          fb->old_revision,
+                                          scratch_pool));
+      SVN_ERR(svn_wc__textbase_get_contents(stream, eb->db, fb->local_abspath,
+                                            fb->original_checksum, FALSE,
+                                            result_pool, scratch_pool));
+    }
 
   return SVN_NO_ERROR;
 }
@@ -5115,6 +5134,8 @@ make_editor(svn_revnum_t *target_revisio
             svn_boolean_t adds_as_modification,
             svn_boolean_t server_performs_filtering,
             svn_boolean_t clean_checkout,
+            svn_wc__textbase_hydrate_cb_t hydrate_func,
+            void *hydrate_baton,
             svn_wc_notify_func2_t notify_func,
             void *notify_baton,
             svn_cancel_func_t cancel_func,
@@ -5193,6 +5214,8 @@ make_editor(svn_revnum_t *target_revisio
 
   eb->requested_depth          = depth;
   eb->depth_is_sticky          = depth_is_sticky;
+  eb->hydrate_func             = hydrate_func;
+  eb->hydrate_baton            = hydrate_baton;
   eb->notify_func              = notify_func;
   eb->notify_baton             = notify_baton;
   eb->external_func            = external_func;
@@ -5405,6 +5428,8 @@ svn_wc__get_update_editor(const svn_delt
                           svn_boolean_t clean_checkout,
                           const char *diff3_cmd,
                           const apr_array_header_t *preserved_exts,
+                          svn_wc__textbase_hydrate_cb_t hydrate_func,
+                          void *hydrate_baton,
                           svn_wc_dirents_func_t fetch_dirents_func,
                           void *fetch_dirents_baton,
                           svn_wc_conflict_resolver_func2_t conflict_func,
@@ -5423,6 +5448,7 @@ svn_wc__get_update_editor(const svn_delt
                      NULL, depth, depth_is_sticky, allow_unver_obstructions,
                      adds_as_modification, server_performs_filtering,
                      clean_checkout,
+                     hydrate_func, hydrate_baton,
                      notify_func, notify_baton,
                      cancel_func, cancel_baton,
                      fetch_dirents_func, fetch_dirents_baton,
@@ -5470,6 +5496,7 @@ svn_wc__get_switch_editor(const svn_delt
                      FALSE /* adds_as_modification */,
                      server_performs_filtering,
                      FALSE /* clean_checkout */,
+                     NULL, NULL,  /* hydrate func/baton */
                      notify_func, notify_baton,
                      cancel_func, cancel_baton,
                      fetch_dirents_func, fetch_dirents_baton,

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db.h?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db.h Tue Mar 15 13:42:47 2022
@@ -3181,6 +3181,21 @@ typedef svn_error_t * (*svn_wc__db_textb
   void *cancel_baton,
   apr_pool_t *scratch_pool);
 
+/* Hydrate the pristine for one file.
+ */
+svn_error_t *
+svn_wc__db_textbase_hydrate(svn_wc__db_t *db,
+                            const char *wri_abspath,
+                            svn_wc__db_textbase_hydrate_cb_t hydrate_callback,
+                            void *hydrate_baton,
+                            svn_cancel_func_t cancel_func,
+                            void *cancel_baton,
+                            const svn_checksum_t *checksum,
+                            const char *repos_root_url,
+                            const char *repos_relpath,
+                            svn_revnum_t revision,
+                            apr_pool_t *scratch_pool);
+
 /* Synchronize the state of the text-bases in DB.
 
    If ALLOW_HYDRATE is true, fetch the referenced but missing text-base

Modified: subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db_textbase.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db_textbase.c?rev=1898948&r1=1898947&r2=1898948&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db_textbase.c (original)
+++ subversion/branches/pristines-on-demand-issue4892/subversion/libsvn_wc/wc_db_textbase.c Tue Mar 15 13:42:47 2022
@@ -168,18 +168,18 @@ svn_wc__db_textbase_walk(svn_wc__db_t *d
   return SVN_NO_ERROR;
 }
 
-static svn_error_t *
-textbase_hydrate(svn_wc__db_t *db,
-                 const char *wri_abspath,
-                 svn_wc__db_textbase_hydrate_cb_t hydrate_callback,
-                 void *hydrate_baton,
-                 svn_cancel_func_t cancel_func,
-                 void *cancel_baton,
-                 const svn_checksum_t *checksum,
-                 const char *repos_root_url,
-                 const char *repos_relpath,
-                 svn_revnum_t revision,
-                 apr_pool_t *scratch_pool)
+svn_error_t *
+svn_wc__db_textbase_hydrate(svn_wc__db_t *db,
+                            const char *wri_abspath,
+                            svn_wc__db_textbase_hydrate_cb_t hydrate_callback,
+                            void *hydrate_baton,
+                            svn_cancel_func_t cancel_func,
+                            void *cancel_baton,
+                            const svn_checksum_t *checksum,
+                            const char *repos_root_url,
+                            const char *repos_relpath,
+                            svn_revnum_t revision,
+                            apr_pool_t *scratch_pool)
 {
   svn_stream_t *install_stream;
   svn_wc__db_install_data_t *install_data;
@@ -326,10 +326,12 @@ svn_wc__db_textbase_sync(svn_wc__db_t *d
                            svn_checksum_to_cstring_display(checksum, iterpool));
                 }
 
-              err = textbase_hydrate(db, local_abspath, hydrate_callback,
-                                     hydrate_baton, cancel_func, cancel_baton,
-                                     checksum, repos_root_url, repos_relpath,
-                                     revision, iterpool);
+              err = svn_wc__db_textbase_hydrate(db, local_abspath,
+                                                hydrate_callback, hydrate_baton,
+                                                cancel_func, cancel_baton,
+                                                checksum, repos_root_url,
+                                                repos_relpath, revision,
+                                                iterpool);
               /* If read access is unauthorized, for some operations we need
                * to continue even though we failed to fetch the textbase. */
               if (err && err->apr_err == SVN_ERR_RA_NOT_AUTHORIZED)