#111 "cvs add" for files from different folders and for multi...

open
WinCvs (90)
5
2005-05-29
2005-05-29
Kirill Müller
No

"cvs add" for files from different folders and for multiple
folders

References (all resolved by this patch):
Bugs 862393, 475284, 914055, 1055966, 877084, 909616
RFE 460781

The "Add" menu item doesn't work if the selected files come
from different folders. This is "by design".

This issue was discussed several times. This restriction was
built in as a response to bug 862393 and as a precaution
against adding a file/dir to a wrong repository.

The reason for 862393 is that the second, third, ...
commands were issued while the first command is still
running. The essential contribution of this patch is the new
class "CCvsDefaultConsole" that allows synchronized
execution of a cvs command while sending the output to the
console window.

The restriction that more than one folder cannot be added
has been simply disabled. I feel that there is no real reason
for that, since there is no technical difference between
issuing two queued commands and letting the user issue
the two commands one by one. The only difference is
convenience.

With this patch, the "add" command works:
- in "flat" mode for several files regardless of their position
in the directory tree
- in "structured" mode for multiple folders and/or files

To allow multiple sandboxes in the hierarchy, a separate cvs
command is issued:
- For every folder added
- For every different parent folder for the files added

Multiple files from the same parent folder are combined into
one cvs command.

<begin internal details>

Internally, CvsCmdAdd is called once for each folder and
one time for all selected files. CvsCmdAdd calls launchCvs
once when passed a folder and several times when passed
a file list for each different parent folder for the file list.
Below you'll find the execution tree for adding folders 1, 2
and files 3.txt and 4.txt in structured mode:

ProcessSelectionCommand
+OnFolder(1)
|\CvsCmdAdd(1)
| \launchCvs(1)
+OnFolder(2)
|\CvsCmdAdd(2)
| \launchCvs(2)
+OnFiles(3.txt, 4.txt)
|\CvsCmdAdd(3.txt, 4.txt)
| \launchCvs(3.txt, 4.txt)

Another execution tree for adding 1\1.txt and 2\2.txt in flat
mode:

ProcessSelectionCommand
+OnFiles(1\1.txt, 2\2.txt)
|\CvsCmdAdd(1\1.txt, 2\2.txt)
| +launchCvs(1.txt {in folder 1})
| \launchCvs(2.txt {in folder 2})

I did not look at the other commands - whether it would
make sense to disable the "one folder" restriction for them.
To disable the restriction, the corresponding CvsCmd...
routine must use a CCvsDefaultConsole for its calls to
launchCvs to allow more than one run of cvs without
returning to the main loop.

<end internal details>

Discussion

  • Kirill Müller
    Kirill Müller
    2005-06-08

    Logged In: YES
    user_id=1241036

    In the first version of the patch, the "Add binary" and "Add
    unicode" commands were disabled when files from more than
    one folder were selected. Fixed by the current patch files. (Only
    BrowseFileView.cpp has changed compared to the first version.)