• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revisión28830 (tree)
Tiempo2020-03-26 05:07:12
Autorstefankueng

Log Message

* switch to the 1.14.x SVN branch
* implement the both the V3 and V2 shelfing APIs, using the same env variable to choose which one as the svn CL client (SVN_EXPERIMENTAL_COMMANDS)

Cambiar Resumen

Diferencia

--- trunk/src/SVN/SVN.cpp (revision 28829)
+++ trunk/src/SVN/SVN.cpp (revision 28830)
@@ -24,6 +24,8 @@
2424 #include "client.h"
2525 #include "svn_compat.h"
2626 #include "private/svn_client_private.h"
27+#include "private/svn_client_shelf.h"
28+#include "private/svn_client_shelf2.h"
2729 #pragma warning(pop)
2830
2931 #include "TortoiseProc.h"
@@ -265,115 +267,234 @@
265267
266268 Prepare();
267269
268- svn_client__shelf_t* shelf = nullptr;
269- // open or create the shelf
270- Err = svn_client__shelf_open_or_create(&shelf,
271- (LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
272- pathlist[0].GetSVNApiPath(subpool),
273- m_pctx, subpool);
274- if (Err == nullptr)
270+ char* pValue;
271+ size_t len;
272+ errno_t err = _dupenv_s(&pValue, &len, "SVN_EXPERIMENTAL_COMMANDS");
273+ if ((err == 0) && pValue && strstr(pValue, "shelf3"))
275274 {
276- // get the last version if there is one
277- svn_client__shelf_version_t* previous_version = nullptr;
278- Err = svn_client__shelf_get_newest_version(&previous_version, shelf, subpool, subpool);
275+ svn_client__shelf_t* shelf = nullptr;
276+ // open or create the shelf
277+ Err = svn_client__shelf_open_or_create(&shelf,
278+ (LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
279+ pathlist[0].GetSVNApiPath(subpool),
280+ m_pctx, subpool);
279281 if (Err == nullptr)
280282 {
281- // set up the callback baton
282- shelf_status_baton sb;
283- sb.target_abspath = shelf->wc_root_abspath;
284- sb.target_path = "";
285- sb.num_paths_shelved = 0;
286- sb.num_paths_not_shelved = 0;
287- sb.pProgressDlg = m_pProgressDlg;
288- sb.ctx = m_pctx;
283+ // get the last version if there is one
284+ svn_client__shelf_version_t* previous_version = nullptr;
285+ Err = svn_client__shelf_get_newest_version(&previous_version, shelf, subpool, subpool);
286+ if (Err == nullptr)
287+ {
288+ // set up the callback baton
289+ shelf_status_baton sb;
290+ sb.target_abspath = shelf->wc_root_abspath;
291+ sb.target_path = "";
292+ sb.num_paths_shelved = 0;
293+ sb.num_paths_not_shelved = 0;
294+ sb.pProgressDlg = m_pProgressDlg;
295+ sb.ctx = m_pctx;
289296
290- svn_client__shelf_version_t* new_version = nullptr;
291- // now create the new version of the shelf
292- Err = svn_client__shelf_save_new_version3(&new_version, shelf,
293- pathlist.MakePathArray(subpool), depth, nullptr,
294- shelved_func, &sb,
295- not_shelved_func, &sb,
296- subpool);
297+ svn_client__shelf_version_t* new_version = nullptr;
298+ // now create the new version of the shelf
299+ Err = svn_client__shelf_save_new_version3(&new_version, shelf,
300+ pathlist.MakePathArray(subpool), depth, nullptr,
301+ shelved_func, &sb,
302+ not_shelved_func, &sb,
303+ subpool);
297304
298- if (sb.num_paths_not_shelved > 0)
299- {
300- if (Err)
301- svn_error_clear(Err);
302- // some paths could not be shelved, so delete the just created version
303- svn_error_clear(svn_client__shelf_delete_newer_versions(shelf, previous_version, subpool));
304- apr_array_header_t* versions_p = nullptr;
305- svn_error_clear(svn_client__shelf_get_all_versions(&versions_p, shelf, subpool, subpool));
306- svn_error_clear(svn_client__shelf_close(shelf, subpool));
307- if (versions_p && versions_p->nelts == 0)
305+ if (sb.num_paths_not_shelved > 0)
308306 {
309- svn_error_clear(svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
310- pathlist[0].GetSVNApiPath(subpool), false,
311- m_pctx, subpool));
307+ if (Err)
308+ svn_error_clear(Err);
309+ // some paths could not be shelved, so delete the just created version
310+ svn_error_clear(svn_client__shelf_delete_newer_versions(shelf, previous_version, subpool));
311+ apr_array_header_t* versions_p = nullptr;
312+ svn_error_clear(svn_client__shelf_get_all_versions(&versions_p, shelf, subpool, subpool));
313+ svn_error_clear(svn_client__shelf_close(shelf, subpool));
314+ if (versions_p && versions_p->nelts == 0)
315+ {
316+ svn_error_clear(svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
317+ pathlist[0].GetSVNApiPath(subpool), false,
318+ m_pctx, subpool));
319+ }
320+
321+ // create an error with the message indicating that
322+ // paths failed to be shelved, and also provide the paths that
323+ // were not shelved.
324+ CString sPaths;
325+ for (size_t i = 0; i < sb.not_shelved_paths.size(); ++i)
326+ {
327+ if (i > 0)
328+ sPaths += L"\n";
329+ sPaths += sb.not_shelved_paths[i];
330+ if ((i > 5) && (sb.not_shelved_paths.size() > 6))
331+ {
332+ // only provide 5-6 paths in the error message to avoid
333+ // getting a too large error dialog.
334+ sPaths += L"\n";
335+ CString sMore;
336+ sMore.Format(IDS_ERR_SHELVE_FAILED_MORE, int(sb.not_shelved_paths.size() - i));
337+ sPaths += sMore;
338+ break;
339+ }
340+ }
341+ CString sError;
342+ sError.Format(IDS_ERR_SHELVE_FAILED_PATHS, (LPCWSTR)sPaths);
343+ Err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, (LPCSTR)CUnicodeUtils::GetUTF8(sError));
312344 }
313-
314- // create an error with the message indicating that
315- // paths failed to be shelved, and also provide the paths that
316- // were not shelved.
317- CString sPaths;
318- for (size_t i = 0; i < sb.not_shelved_paths.size(); ++i)
345+ else if (sb.num_paths_shelved == 0 || !new_version)
319346 {
320- if (i > 0)
321- sPaths += L"\n";
322- sPaths += sb.not_shelved_paths[i];
323- if ((i > 5) && (sb.not_shelved_paths.size() > 6))
347+ if (Err)
348+ svn_error_clear(Err);
349+ svn_error_clear(svn_client__shelf_delete_newer_versions(shelf, previous_version, subpool));
350+ apr_array_header_t* versions_p = nullptr;
351+ svn_error_clear(svn_client__shelf_get_all_versions(&versions_p, shelf, subpool, subpool));
352+ Err = svn_client__shelf_close(shelf, subpool);
353+ if (versions_p && versions_p->nelts == 0)
324354 {
325- // only provide 5-6 paths in the error message to avoid
326- // getting a too large error dialog.
327- sPaths += L"\n";
328- CString sMore;
329- sMore.Format(IDS_ERR_SHELVE_FAILED_MORE, int(sb.not_shelved_paths.size() - i));
330- sPaths += sMore;
331- break;
355+ svn_error_clear(svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
356+ pathlist[0].GetSVNApiPath(subpool), false,
357+ m_pctx, subpool));
332358 }
359+ if (Err == nullptr)
360+ Err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, (LPCSTR)CUnicodeUtils::GetUTF8(CString(MAKEINTRESOURCE(IDS_ERR_SHELVE_NOTHING_WAS_SHELVED))));
333361 }
334- CString sError;
335- sError.Format(IDS_ERR_SHELVE_FAILED_PATHS, (LPCWSTR)sPaths);
336- Err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, (LPCSTR)CUnicodeUtils::GetUTF8(sError));
337- }
338- else if (sb.num_paths_shelved == 0 || !new_version)
339- {
340- if (Err)
341- svn_error_clear(Err);
342- svn_error_clear(svn_client__shelf_delete_newer_versions(shelf, previous_version, subpool));
343- apr_array_header_t* versions_p = nullptr;
344- svn_error_clear(svn_client__shelf_get_all_versions(&versions_p, shelf, subpool, subpool));
345- Err = svn_client__shelf_close(shelf, subpool);
346- if (versions_p && versions_p->nelts == 0)
362+ else
347363 {
348- svn_error_clear(svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
349- pathlist[0].GetSVNApiPath(subpool), false,
350- m_pctx, subpool));
364+ if (revert)
365+ {
366+ // revert the shelved files so they appear as not modified
367+ Err = svn_client__shelf_unapply(new_version, false, subpool);
368+ }
369+ if (Err == nullptr)
370+ {
371+ svn_string_t* propval = svn_string_create((LPCSTR)CUnicodeUtils::GetUTF8(logMsg), subpool);
372+
373+ apr_hash_t* revprop_table = apr_hash_make(subpool);
374+ apr_hash_set(revprop_table, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING, propval);
375+ Err = svn_client__shelf_revprop_set_all(shelf, revprop_table, subpool);
376+ if (Err == nullptr)
377+ {
378+ Err = svn_client__shelf_close(shelf, subpool);
379+ }
380+ }
351381 }
352- if (Err == nullptr)
353- Err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, (LPCSTR)CUnicodeUtils::GetUTF8(CString(MAKEINTRESOURCE(IDS_ERR_SHELVE_NOTHING_WAS_SHELVED))));
354382 }
355- else
383+ }
384+ }
385+ else
386+ {
387+ svn_client__shelf2_t* shelf = nullptr;
388+ // open or create the shelf
389+ Err = svn_client__shelf2_open_or_create(&shelf,
390+ (LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
391+ pathlist[0].GetSVNApiPath(subpool),
392+ m_pctx, subpool);
393+ if (Err == nullptr)
394+ {
395+ // get the last version if there is one
396+ svn_client__shelf2_version_t* previous_version = nullptr;
397+ Err = svn_client__shelf2_get_newest_version(&previous_version, shelf, subpool, subpool);
398+ if (Err == nullptr)
356399 {
357- if (revert)
400+ // set up the callback baton
401+ shelf_status_baton sb;
402+ sb.target_abspath = shelf->wc_root_abspath;
403+ sb.target_path = "";
404+ sb.num_paths_shelved = 0;
405+ sb.num_paths_not_shelved = 0;
406+ sb.pProgressDlg = m_pProgressDlg;
407+ sb.ctx = m_pctx;
408+
409+ svn_client__shelf2_version_t* new_version = nullptr;
410+ // now create the new version of the shelf
411+ Err = svn_client__shelf2_save_new_version3(&new_version, shelf,
412+ pathlist.MakePathArray(subpool), depth, nullptr,
413+ shelved_func, &sb,
414+ not_shelved_func, &sb,
415+ subpool);
416+
417+ if (sb.num_paths_not_shelved > 0)
358418 {
359- // revert the shelved files so they appear as not modified
360- Err = svn_client__shelf_unapply(new_version, false, subpool);
419+ if (Err)
420+ svn_error_clear(Err);
421+ // some paths could not be shelved, so delete the just created version
422+ svn_error_clear(svn_client__shelf2_delete_newer_versions(shelf, previous_version, subpool));
423+ apr_array_header_t* versions_p = nullptr;
424+ svn_error_clear(svn_client__shelf2_get_all_versions(&versions_p, shelf, subpool, subpool));
425+ svn_error_clear(svn_client__shelf2_close(shelf, subpool));
426+ if (versions_p && versions_p->nelts == 0)
427+ {
428+ svn_error_clear(svn_client__shelf2_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
429+ pathlist[0].GetSVNApiPath(subpool), false,
430+ m_pctx, subpool));
431+ }
432+
433+ // create an error with the message indicating that
434+ // paths failed to be shelved, and also provide the paths that
435+ // were not shelved.
436+ CString sPaths;
437+ for (size_t i = 0; i < sb.not_shelved_paths.size(); ++i)
438+ {
439+ if (i > 0)
440+ sPaths += L"\n";
441+ sPaths += sb.not_shelved_paths[i];
442+ if ((i > 5) && (sb.not_shelved_paths.size() > 6))
443+ {
444+ // only provide 5-6 paths in the error message to avoid
445+ // getting a too large error dialog.
446+ sPaths += L"\n";
447+ CString sMore;
448+ sMore.Format(IDS_ERR_SHELVE_FAILED_MORE, int(sb.not_shelved_paths.size() - i));
449+ sPaths += sMore;
450+ break;
451+ }
452+ }
453+ CString sError;
454+ sError.Format(IDS_ERR_SHELVE_FAILED_PATHS, (LPCWSTR)sPaths);
455+ Err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, (LPCSTR)CUnicodeUtils::GetUTF8(sError));
361456 }
362- if (Err == nullptr)
457+ else if (sb.num_paths_shelved == 0 || !new_version)
363458 {
364- svn_string_t* propval = svn_string_create((LPCSTR)CUnicodeUtils::GetUTF8(logMsg), subpool);
365-
366- apr_hash_t* revprop_table = apr_hash_make(subpool);
367- apr_hash_set(revprop_table, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING, propval);
368- Err = svn_client__shelf_revprop_set_all(shelf, revprop_table, subpool);
459+ if (Err)
460+ svn_error_clear(Err);
461+ svn_error_clear(svn_client__shelf2_delete_newer_versions(shelf, previous_version, subpool));
462+ apr_array_header_t* versions_p = nullptr;
463+ svn_error_clear(svn_client__shelf2_get_all_versions(&versions_p, shelf, subpool, subpool));
464+ Err = svn_client__shelf2_close(shelf, subpool);
465+ if (versions_p && versions_p->nelts == 0)
466+ {
467+ svn_error_clear(svn_client__shelf2_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
468+ pathlist[0].GetSVNApiPath(subpool), false,
469+ m_pctx, subpool));
470+ }
369471 if (Err == nullptr)
472+ Err = svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL, (LPCSTR)CUnicodeUtils::GetUTF8(CString(MAKEINTRESOURCE(IDS_ERR_SHELVE_NOTHING_WAS_SHELVED))));
473+ }
474+ else
475+ {
476+ if (revert)
370477 {
371- Err = svn_client__shelf_close(shelf, subpool);
478+ // revert the shelved files so they appear as not modified
479+ Err = svn_client__shelf2_unapply(new_version, false, subpool);
372480 }
481+ if (Err == nullptr)
482+ {
483+ svn_string_t* propval = svn_string_create((LPCSTR)CUnicodeUtils::GetUTF8(logMsg), subpool);
484+
485+ apr_hash_t* revprop_table = apr_hash_make(subpool);
486+ apr_hash_set(revprop_table, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING, propval);
487+ Err = svn_client__shelf2_revprop_set_all(shelf, revprop_table, subpool);
488+ if (Err == nullptr)
489+ {
490+ Err = svn_client__shelf2_close(shelf, subpool);
491+ }
492+ }
373493 }
374494 }
375495 }
376496 }
497+ free(pValue);
377498
378499 return (Err == NULL);
379500 }
@@ -384,30 +505,62 @@
384505
385506 Prepare();
386507
387- svn_client__shelf_t* shelf = nullptr;
508+ char* pValue;
509+ size_t len;
510+ errno_t err = _dupenv_s(&pValue, &len, "SVN_EXPERIMENTAL_COMMANDS");
511+ if ((err == 0) && pValue && strstr(pValue, "shelf3"))
512+ {
513+ svn_client__shelf_t* shelf = nullptr;
388514
389- Err = svn_client__shelf_open_existing(&shelf,
390- CUnicodeUtils::GetUTF8(shelveName),
391- local_abspath.GetSVNApiPath(subpool), m_pctx, subpool);
392- if (Err == nullptr)
515+ Err = svn_client__shelf_open_existing(&shelf,
516+ CUnicodeUtils::GetUTF8(shelveName),
517+ local_abspath.GetSVNApiPath(subpool), m_pctx, subpool);
518+ if (Err == nullptr)
519+ {
520+ svn_client__shelf_version_t* shelf_version = nullptr;
521+ if (version > 0)
522+ Err = svn_client__shelf_version_open(&shelf_version, shelf, version, subpool, subpool);
523+ else
524+ Err = svn_client__shelf_get_newest_version(&shelf_version, shelf, subpool, subpool);
525+ if (Err == nullptr)
526+ {
527+ Err = svn_client__shelf_apply(shelf_version, false, subpool);
528+ if (Err == nullptr)
529+ {
530+ svn_error_clear(svn_client__shelf_delete_newer_versions(shelf, shelf_version, subpool));
531+
532+ Err = svn_client__shelf_close(shelf, subpool);
533+ }
534+ }
535+ }
536+ }
537+ else
393538 {
394- svn_client__shelf_version_t* shelf_version = nullptr;
395- if (version > 0)
396- Err = svn_client__shelf_version_open(&shelf_version, shelf, version, subpool, subpool);
397- else
398- Err = svn_client__shelf_get_newest_version(&shelf_version, shelf, subpool, subpool);
539+ svn_client__shelf2_t* shelf = nullptr;
540+
541+ Err = svn_client__shelf2_open_existing(&shelf,
542+ CUnicodeUtils::GetUTF8(shelveName),
543+ local_abspath.GetSVNApiPath(subpool), m_pctx, subpool);
399544 if (Err == nullptr)
400545 {
401- Err = svn_client__shelf_apply(shelf_version, false, subpool);
546+ svn_client__shelf2_version_t* shelf_version = nullptr;
547+ if (version > 0)
548+ Err = svn_client__shelf2_version_open(&shelf_version, shelf, version, subpool, subpool);
549+ else
550+ Err = svn_client__shelf2_get_newest_version(&shelf_version, shelf, subpool, subpool);
402551 if (Err == nullptr)
403552 {
404- svn_error_clear(svn_client__shelf_delete_newer_versions(shelf, shelf_version, subpool));
553+ Err = svn_client__shelf2_apply(shelf_version, false, subpool);
554+ if (Err == nullptr)
555+ {
556+ svn_error_clear(svn_client__shelf2_delete_newer_versions(shelf, shelf_version, subpool));
405557
406- Err = svn_client__shelf_close(shelf, subpool);
558+ Err = svn_client__shelf2_close(shelf, subpool);
559+ }
407560 }
408561 }
409562 }
410-
563+ free(pValue);
411564 return (Err == NULL);
412565 }
413566
@@ -419,43 +572,90 @@
419572
420573 ShelfInfo info;
421574
422- svn_client__shelf_t* shelf = nullptr;
423- Err = svn_client__shelf_open_existing(&shelf,
424- (LPCSTR)CUnicodeUtils::GetUTF8(shelfName),
425- local_abspath.GetSVNApiPath(subpool), m_pctx, subpool);
426- if (Err == nullptr)
575+ char* pValue;
576+ size_t len;
577+ errno_t err = _dupenv_s(&pValue, &len, "SVN_EXPERIMENTAL_COMMANDS");
578+ if ((err == 0) && pValue && strstr(pValue, "shelf3"))
427579 {
428- info.Name = shelfName;
429- char* logmsg = nullptr;
430- Err = svn_client__shelf_get_log_message(&logmsg, shelf, subpool);
580+ svn_client__shelf_t* shelf = nullptr;
581+ Err = svn_client__shelf_open_existing(&shelf,
582+ (LPCSTR)CUnicodeUtils::GetUTF8(shelfName),
583+ local_abspath.GetSVNApiPath(subpool), m_pctx, subpool);
431584 if (Err == nullptr)
432585 {
433- info.LogMessage = CUnicodeUtils::GetUnicode(logmsg);
586+ info.Name = shelfName;
587+ char* logmsg = nullptr;
588+ Err = svn_client__shelf_get_log_message(&logmsg, shelf, subpool);
589+ if (Err == nullptr)
590+ {
591+ info.LogMessage = CUnicodeUtils::GetUnicode(logmsg);
592+ }
593+ apr_array_header_t* versions_p = nullptr;
594+ Err = svn_client__shelf_get_all_versions(&versions_p, shelf, subpool, subpool);
595+ if (Err == nullptr)
596+ {
597+ for (int i = 0; i < versions_p->nelts; i++)
598+ {
599+ svn_client__shelf_version_t* shelf_version = (svn_client__shelf_version_t*)APR_ARRAY_IDX(versions_p, i, void*);
600+
601+ CTSVNPathList changedFiles;
602+ apr_hash_t* affectedpaths = nullptr;
603+ Err = svn_client__shelf_paths_changed(&affectedpaths, shelf_version, subpool, subpool);
604+ if (Err == nullptr)
605+ {
606+ for (apr_hash_index_t* hi = apr_hash_first(subpool, affectedpaths); hi; hi = apr_hash_next(hi))
607+ {
608+ const char* path = (const char*)apr_hash_this_key(hi);
609+ changedFiles.AddPath(CTSVNPath(CUnicodeUtils::GetUnicode(path)));
610+ }
611+ }
612+ info.versions.push_back(std::make_tuple(shelf_version->mtime, changedFiles));
613+ }
614+ }
615+ Err = svn_client__shelf_close(shelf, subpool);
434616 }
435- apr_array_header_t* versions_p = nullptr;
436- Err = svn_client__shelf_get_all_versions(&versions_p, shelf, subpool, subpool);
617+ }
618+ else
619+ {
620+ svn_client__shelf2_t* shelf = nullptr;
621+ Err = svn_client__shelf2_open_existing(&shelf,
622+ (LPCSTR)CUnicodeUtils::GetUTF8(shelfName),
623+ local_abspath.GetSVNApiPath(subpool), m_pctx, subpool);
437624 if (Err == nullptr)
438625 {
439- for (int i = 0; i < versions_p->nelts; i++)
626+ info.Name = shelfName;
627+ char* logmsg = nullptr;
628+ Err = svn_client__shelf2_get_log_message(&logmsg, shelf, subpool);
629+ if (Err == nullptr)
440630 {
441- svn_client__shelf_version_t* shelf_version = (svn_client__shelf_version_t*)APR_ARRAY_IDX(versions_p, i, void*);
631+ info.LogMessage = CUnicodeUtils::GetUnicode(logmsg);
632+ }
633+ apr_array_header_t* versions_p = nullptr;
634+ Err = svn_client__shelf2_get_all_versions(&versions_p, shelf, subpool, subpool);
635+ if (Err == nullptr)
636+ {
637+ for (int i = 0; i < versions_p->nelts; i++)
638+ {
639+ svn_client__shelf2_version_t* shelf_version = (svn_client__shelf2_version_t*)APR_ARRAY_IDX(versions_p, i, void*);
442640
443- CTSVNPathList changedFiles;
444- apr_hash_t* affectedpaths = nullptr;
445- Err = svn_client__shelf_paths_changed(&affectedpaths, shelf_version, subpool, subpool);
446- if (Err == nullptr)
447- {
448- for (apr_hash_index_t* hi = apr_hash_first(subpool, affectedpaths); hi; hi = apr_hash_next(hi))
641+ CTSVNPathList changedFiles;
642+ apr_hash_t* affectedpaths = nullptr;
643+ Err = svn_client__shelf2_paths_changed(&affectedpaths, shelf_version, subpool, subpool);
644+ if (Err == nullptr)
449645 {
450- const char* path = (const char*)apr_hash_this_key(hi);
451- changedFiles.AddPath(CTSVNPath(CUnicodeUtils::GetUnicode(path)));
646+ for (apr_hash_index_t* hi = apr_hash_first(subpool, affectedpaths); hi; hi = apr_hash_next(hi))
647+ {
648+ const char* path = (const char*)apr_hash_this_key(hi);
649+ changedFiles.AddPath(CTSVNPath(CUnicodeUtils::GetUnicode(path)));
650+ }
452651 }
652+ info.versions.push_back(std::make_tuple(shelf_version->mtime, changedFiles));
453653 }
454- info.versions.push_back(std::make_tuple(shelf_version->mtime, changedFiles));
455654 }
655+ Err = svn_client__shelf2_close(shelf, subpool);
456656 }
457- Err = svn_client__shelf_close(shelf, subpool);
458657 }
658+ free(pValue);
459659 return info;
460660 }
461661
@@ -466,22 +666,48 @@
466666 Prepare();
467667 apr_hash_t* names_hash;
468668
469- SVNTRACE(
470- Err = svn_client__shelf_list(&names_hash,
471- local_abspath.GetSVNApiPath(subpool),
472- m_pctx,
473- subpool, subpool),
474- NULL);
475- if (Err)
476- return false;
669+ char* pValue;
670+ size_t len;
671+ errno_t err = _dupenv_s(&pValue, &len, "SVN_EXPERIMENTAL_COMMANDS");
672+ if ((err == 0) && pValue && strstr(pValue, "shelf3"))
673+ {
674+ SVNTRACE(
675+ Err = svn_client__shelf_list(&names_hash,
676+ local_abspath.GetSVNApiPath(subpool),
677+ m_pctx,
678+ subpool, subpool),
679+ NULL);
680+ if (Err)
681+ return false;
477682
478- apr_hash_index_t* hi;
479- for (hi = apr_hash_first(subpool, names_hash); hi; hi = apr_hash_next(hi))
683+ apr_hash_index_t* hi;
684+ for (hi = apr_hash_first(subpool, names_hash); hi; hi = apr_hash_next(hi))
685+ {
686+ CString name = CUnicodeUtils::GetUnicode((const char*)apr_hash_this_key(hi));
687+ Names.push_back(name);
688+ }
689+ std::sort(Names.begin(), Names.end());
690+ }
691+ else
480692 {
481- CString name = CUnicodeUtils::GetUnicode((const char*)apr_hash_this_key(hi));
482- Names.push_back(name);
693+ SVNTRACE(
694+ Err = svn_client__shelf2_list(&names_hash,
695+ local_abspath.GetSVNApiPath(subpool),
696+ m_pctx,
697+ subpool, subpool),
698+ NULL);
699+ if (Err)
700+ return false;
701+
702+ apr_hash_index_t* hi;
703+ for (hi = apr_hash_first(subpool, names_hash); hi; hi = apr_hash_next(hi))
704+ {
705+ CString name = CUnicodeUtils::GetUnicode((const char*)apr_hash_this_key(hi));
706+ Names.push_back(name);
707+ }
708+ std::sort(Names.begin(), Names.end());
483709 }
484- std::sort(Names.begin(), Names.end());
710+ free(pValue);
485711
486712 return (Err == nullptr);
487713 }
@@ -491,14 +717,28 @@
491717 SVNPool subpool(m_pool);
492718
493719 Prepare();
494-
495- SVNTRACE(
496- Err = svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
497- local_abspath.GetSVNApiPath(subpool),
498- false,
499- m_pctx, subpool),
500- NULL);
501-
720+ char* pValue;
721+ size_t len;
722+ errno_t err = _dupenv_s(&pValue, &len, "SVN_EXPERIMENTAL_COMMANDS");
723+ if ((err == 0) && pValue && strstr(pValue, "shelf3"))
724+ {
725+ SVNTRACE(
726+ Err = svn_client__shelf_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
727+ local_abspath.GetSVNApiPath(subpool),
728+ false,
729+ m_pctx, subpool),
730+ NULL);
731+ }
732+ else
733+ {
734+ SVNTRACE(
735+ Err = svn_client__shelf2_delete((LPCSTR)CUnicodeUtils::GetUTF8(shelveName),
736+ local_abspath.GetSVNApiPath(subpool),
737+ false,
738+ m_pctx, subpool),
739+ NULL);
740+ }
741+ free(pValue);
502742 return (Err == nullptr);
503743 }
504744
Show on old repository browser