You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2022/11/21 16:25:25 UTC

svn commit: r1905441 - in /subversion/branches/pristines-on-demand-on-mwf/subversion: include/svn_wc.h libsvn_wc/info.c svn/info-cmd.c svn/schema/info.rnc svn/svn.c tests/cmdline/store_pristine_tests.py

Author: kotkov
Date: Mon Nov 21 16:25:24 2022
New Revision: 1905441

URL: http://svn.apache.org/viewvc?rev=1905441&view=rev
Log:
On the 'pristines-on-demand-on-mwf' branch: Teach `svn info` to report the
state of the `--store-pristine` option for a working copy.

* subversion/include/svn_wc.h
  (svn_wc_info_t): Add new `store_pristine` field.

* subversion/libsvn_wc/info.c
  (build_info_for_node): Fill in the new field.

* subversion/svn/info-cmd.c
  (info_item_t, info_item_map): Add `info_item_store_pristine`.
  (print_info_xml, print_info, print_info_item): Output the new
   `store_pristine` state.

* subversion/svn/svn.c
  (svn_cl__cmd_table_main): Update help for `svn info`.

* subversion/tests/cmdline/store_pristine_tests.py
  (simple_checkout_with_pristine,
   simple_checkout_without_pristine,
   simple_commit_with_pristine,
   simple_commit_without_pristine,
   simple_update_with_pristine,
   simple_update_without_pristine,
   simple_status_with_pristine,
   simple_status_without_pristine,
   simple_diff_with_pristine,
   simple_diff_without_pristine,
   simple_revert_with_pristine,
   simple_revert_without_pristine,
   update_modified_file_with_pristine,
   update_modified_file_without_pristine):
   Check the output of svn info --show-item=store-pristine.

* subversion/svn/schema/info.rnc: Update schema for `svn info --xml`.

Modified:
    subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h
    subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/info.c
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/info-cmd.c
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/schema/info.rnc
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c
    subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h?rev=1905441&r1=1905440&r2=1905441&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/include/svn_wc.h Mon Nov 21 16:25:24 2022
@@ -3314,6 +3314,12 @@ typedef struct svn_wc_info_t
    * @since New in 1.15.
    */
   int wc_format;
+
+  /**
+   * Whether pristine content is stored locally or is being fetched on-demand.
+   * @since New in 1.15.
+   */
+  svn_boolean_t store_pristine;
 } svn_wc_info_t;
 
 /**

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/info.c?rev=1905441&r1=1905440&r2=1905441&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/info.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/libsvn_wc/info.c Mon Nov 21 16:25:24 2022
@@ -106,7 +106,8 @@ build_info_for_node(svn_wc__info2_t **in
 
   wc_info->copyfrom_rev = SVN_INVALID_REVNUM;
 
-  SVN_ERR(svn_wc__db_get_settings(&wc_info->wc_format, NULL,
+  SVN_ERR(svn_wc__db_get_settings(&wc_info->wc_format,
+                                  &wc_info->store_pristine,
                                   db, local_abspath, scratch_pool));
 
   SVN_ERR(svn_wc__db_read_info(&status, &db_kind, &tmpinfo->rev,

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/info-cmd.c?rev=1905441&r1=1905440&r2=1905441&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/info-cmd.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/info-cmd.c Mon Nov 21 16:25:24 2022
@@ -371,7 +371,8 @@ typedef enum
   info_item_depth,
   info_item_changelist,
   info_item_wc_format,
-  info_item_wc_compatible_version
+  info_item_wc_compatible_version,
+  info_item_store_pristine,
 } info_item_t;
 
 /* Mapping between option keywords and info_item_t. */
@@ -401,6 +402,7 @@ static const info_item_map_t info_item_m
     { SVN__STATIC_STRING("wc-format"),           info_item_wc_format },
     { SVN__STATIC_STRING("wc-compatible-version"),
                                                  info_item_wc_compatible_version },
+    { SVN__STATIC_STRING("store-pristine"),      info_item_store_pristine },
   };
 
 static const apr_size_t info_item_map_len =
@@ -607,6 +609,10 @@ print_info_xml(void *baton,
                                                 info->wc_info->wc_format));
         }
 
+      /* "<store-pristine> xx </store-pristine>" */
+      svn_cl__xml_tagged_cdata(&sb, pool, "store-pristine",
+                               info->wc_info->store_pristine ? "yes" : "no");
+
       /* "<schedule> xx </schedule>" */
       svn_cl__xml_tagged_cdata(&sb, pool, "schedule",
                                schedule_str(info->wc_info->schedule));
@@ -763,6 +769,15 @@ print_info(void *baton,
                                  info->wc_info->wc_format));
     }
 
+  if (info->wc_info)
+    {
+      if (info->wc_info->store_pristine)
+        SVN_ERR(svn_cmdline_fputs(_("Working Copy Store Pristine: yes\n"),
+                                  stdout, pool));
+      else
+        SVN_ERR(svn_cmdline_fputs(_("Working Copy Store Pristine: no\n"),
+                                  stdout, pool));
+    }
 
   if (info->URL)
     SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL));
@@ -1296,6 +1311,19 @@ print_info_item(void *baton,
                   target_path, pool));
       break;
 
+    case info_item_store_pristine:
+      {
+        const char *text;
+
+        if (info->wc_info)
+          text = info->wc_info->store_pristine ? "yes" : "no";
+        else
+          text = NULL;
+
+        SVN_ERR(print_info_item_string(text, target_path, pool));
+      }
+      break;
+
     default:
       SVN_ERR_MALFUNCTION();
     }

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/svn/schema/info.rnc
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/schema/info.rnc?rev=1905441&r1=1905440&r2=1905441&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/schema/info.rnc (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/schema/info.rnc Mon Nov 21 16:25:24 2022
@@ -59,6 +59,7 @@ wc-info =
     wcroot-abspath?,
     wc-compatible-version?,
     wc-format?,
+    store-pristine?,
     schedule?,
     changelist?,
     copy-from-url?,
@@ -74,6 +75,7 @@ wc-info =
 wcroot-abspath = element wcroot-abspath { string }
 wc-compatible-version = element wc-compatible-version { string }
 wc-format = element wc-format { xsd:nonNegativeInteger }
+store-pristine = element store-pristine { "yes" | "no" }
 
 schedule =
   element schedule { "normal" | "add" | "delete" | "replace" | "none" }

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c?rev=1905441&r1=1905440&r2=1905441&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c Mon Nov 21 16:25:24 2022
@@ -811,7 +811,11 @@ svn_cl__cmd_table_main[] =
                         "                             "
                         "                first version supporting TARGET WC\n"
                         "                             "
-                        "   'changelist' changelist of TARGET in WC")}},
+                        "   'changelist' changelist of TARGET in WC\n"
+                        "                             "
+                        "   'store-pristine'\n"
+                        "                             "
+                        "                TARGET's working copy pristine mode")}},
   },
 
   { "list", svn_cl__list, {"ls"},

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py?rev=1905441&r1=1905440&r2=1905441&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/store_pristine_tests.py Mon Nov 21 16:25:24 2022
@@ -54,6 +54,10 @@ def simple_checkout_with_pristine(sbox):
                                           expected_disk,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
 
 @SkipUnless(svntest.main.is_wc_pristines_on_demand_supported)
 def simple_checkout_without_pristine(sbox):
@@ -68,6 +72,10 @@ def simple_checkout_without_pristine(sbo
                                           expected_disk,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
 
 def simple_commit_with_pristine(sbox):
   "simple commit with pristine"
@@ -81,6 +89,10 @@ def simple_commit_with_pristine(sbox):
                                           expected_disk,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
 
   sbox.simple_append('file', 'contents')
   sbox.simple_add('file')
@@ -109,6 +121,10 @@ def simple_commit_without_pristine(sbox)
                                           expected_disk,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
 
   sbox.simple_append('file', 'contents')
   sbox.simple_add('file')
@@ -136,6 +152,11 @@ def simple_update_with_pristine(sbox):
                                           expected_wc,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -173,6 +194,11 @@ def simple_update_without_pristine(sbox)
                                           expected_wc,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -209,6 +235,11 @@ def simple_status_with_pristine(sbox):
                                           expected_wc,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo')
   sbox.simple_add('file')
 
@@ -260,6 +291,11 @@ def simple_status_without_pristine(sbox)
                                           expected_wc,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo')
   sbox.simple_add('file')
 
@@ -310,6 +346,11 @@ def simple_diff_with_pristine(sbox):
                                           expected_wc,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo\n')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -338,6 +379,11 @@ def simple_diff_without_pristine(sbox):
                                           expected_wc,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo\n')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -365,6 +411,11 @@ def simple_revert_with_pristine(sbox):
                                           expected_wc,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo\n')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -393,6 +444,11 @@ def simple_revert_without_pristine(sbox)
                                           expected_wc,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo\n')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -420,6 +476,11 @@ def update_modified_file_with_pristine(s
                                           expected_wc,
                                           [],
                                           "--store-pristine=yes")
+  svntest.actions.run_and_verify_svn(
+    ['yes'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')
@@ -460,6 +521,11 @@ def update_modified_file_without_pristin
                                           expected_wc,
                                           [],
                                           "--store-pristine=no")
+  svntest.actions.run_and_verify_svn(
+    ['no'], [],
+    'info', '--show-item=store-pristine', '--no-newline',
+    sbox.wc_dir)
+
   sbox.simple_append('file', 'foo')
   sbox.simple_add('file')
   sbox.simple_commit(message='r1')