Skip to content

Commit 3ec7ec4

Browse files
committed
Display change totals (affected directory/file count) in commit dialog
1 parent a2bedb3 commit 3ec7ec4

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1414
- Added `--auto-deploy` option to `commit` command to allow overriding behavior imposed by `commit.auto-deploy` config setting.
1515
- Added `update.auto-deploy` config setting (enabled by default), that allows to tell if a local deployment should happen after successful update.
1616
- Added `--auto-deploy` option to `update` command to allow overriding behavior imposed by `update.auto-deploy` config setting.
17+
- Display change totals (affected directory/file count) in commit dialog.
1718

1819
### Changed
1920
- The `config` command groups configuration settings by a command.

src/SVNBuddy/Repository/Connector/Connector.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,35 @@ public function getCompactWorkingCopyStatus(
488488
$changelist = null,
489489
array $except_statuses = array(self::STATUS_UNVERSIONED, self::STATUS_EXTERNAL)
490490
) {
491-
$ret = array();
491+
$file_count = $directory_count = 0;
492+
$working_copy_status = $this->getWorkingCopyStatus($wc_path, $changelist, $except_statuses);
493+
494+
if ( !$working_copy_status ) {
495+
return '';
496+
}
497+
498+
foreach ( array_keys($working_copy_status) as $path ) {
499+
if ( is_dir($wc_path . '/' . $path) ) {
500+
$directory_count++;
501+
}
502+
else {
503+
$file_count++;
504+
}
505+
}
506+
507+
$totals_line = array();
508+
509+
if ( $directory_count > 0 ) {
510+
$totals_line[] = $directory_count . ' ' . ($directory_count > 1 ? 'directories' : 'directory');
511+
}
512+
513+
if ( $file_count ) {
514+
$totals_line[] = $file_count . ' ' . ($file_count > 1 ? 'files' : 'file');
515+
}
516+
517+
$ret = array(implode(' and ', $totals_line), '');
492518

493-
foreach ( $this->getWorkingCopyStatus($wc_path, $changelist, $except_statuses) as $path => $status ) {
519+
foreach ( $working_copy_status as $path => $status ) {
494520
$line = $this->getShortItemStatus($status['item']); // Path status.
495521
$line .= $this->getShortPropertiesStatus($status['props']); // Properties status.
496522
$line .= ' '; // Locked status.

0 commit comments

Comments
 (0)