Disclosure of Invention
Aiming at the technical problems, the invention realizes the version control function of the file or the folder in the mobile storage medium, and overcomes the problems of complicated realization, complex installation and the like of the traditional software.
The invention is realized by adopting the following method: a mobile storage method having a version control function, comprising:
initializing a file or a folder needing to be subjected to version control, and storing the current version of the file or the folder in a common storage area;
when the storage operation exists, judging whether the file or the folder is modified, if not, replacing the current version with the last version and storing the current version in the common storage area, and keeping the version number unchanged; if the version number of the current version is not the same as the version number of the current version, the current version is stored in the version control area, the last version is used for replacing the current version and storing the current version in the common storage area, and the version number is modified.
Further, the determining whether the file or the folder is modified specifically includes: and comparing the file or the folder of the last version with the file or the folder of the current version, if the file or the folder of the last version is the same, judging that no modification exists, and if the file or the folder of the last version is different, judging that the modification exists.
Further, still include: and generating a version list including remarks, and calling a file or a folder of a corresponding version from the version control area by using the version list.
The invention can be realized by adopting the following devices: a removable storage device with version control functionality, the device comprising a memory for storing a plurality of instructions and a processor for loading the instructions stored in the memory to perform:
initializing a file or a folder needing to be subjected to version control, and storing the current version of the file or the folder in a common storage area;
when the storage operation exists, judging whether the file or the folder is modified, if not, replacing the current version with the last version and storing the current version in the common storage area, and keeping the version number unchanged; if the version number of the current version is not the same as the version number of the current version, the current version is stored in the version control area, the last version is used for replacing the current version and storing the current version in the common storage area, and the version number is modified.
Further, the determining whether the file or the folder is modified specifically includes: and comparing the file or the folder of the last version with the file or the folder of the current version, if the file or the folder of the last version is the same, judging that no modification exists, and if the file or the folder of the last version is different, judging that the modification exists.
Further, still include: and generating a version list including remarks, and calling a file or a folder of a corresponding version from the version control area by using the version list.
Meanwhile, the invention can be realized by adopting the following devices: a mobile storage device having a version control function, comprising:
the initialization module is used for initializing a file or a folder which needs to be subjected to version control and storing the current version of the file or the folder in a common storage area;
the version control module is used for judging whether the file or the folder is modified or not when the storage operation exists, replacing the current version with the last version and storing the current version in the common storage area if the file or the folder is not modified, and keeping the version number unchanged; if the current version exists, the current version is stored in the version control area, the last version is used for replacing the current version and storing the current version in the common storage area, and the version number is modified;
a common storage area for storing common data and a last version file or folder;
and the version control area is used for storing all versions of files or folders for version control except the last version.
Further, the determining whether the file or the folder is modified specifically includes: and comparing the file or the folder of the last version with the file or the folder of the current version, if the file or the folder of the last version is the same, judging that no modification exists, and if the file or the folder of the last version is different, judging that the modification exists.
Further, still include: and generating a version list including remarks, and calling a file or a folder of a corresponding version from the version control area by using the version list.
The present invention also proposes a non-transitory computer-readable removable storage medium, on which a computer program is stored, which when executed by a processor implements a removable storage method with a version control function as described in any one of the above.
In summary, the present invention provides a mobile storage method, a device and a storage medium with a version control function, in which the technical solution of the present invention utilizes a USB interface of the mobile storage medium to complete communication with an upper computer, and includes two storage areas: the file management system comprises a common storage area and a version control area, wherein files or folders of the last version are stored in the common storage area, and files or folders of other versions except the last version are stored in the version control area. Further, other versions of files or folders may be called as desired by the user.
The method, the device and the storage medium of the invention realize the storage and management of files or folders of multi-version data by utilizing the hardware characteristic of the mobile storage medium, realize the function of version control and overcome the defects of complex use, complex installation and larger occupied storage space caused by the prior realization of the version control by utilizing software.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present invention and make the above objects, features, and advantages of the present invention more obvious and understandable, the following will explain the technical solutions in the present invention in detail with reference to the accompanying drawings:
as shown in fig. 1, the present invention first provides an embodiment of a mobile storage method with a version control function, including:
s101: initializing a file or a folder needing to be subjected to version control, and storing the current version of the file or the folder in a common storage area; specifically, but not limited to, the user selects a file or a folder which needs to be version-controlled by using the version control software in the mobile storage medium, and can set notes for each version of each software, further distinguish information of each version, and click to save to complete initialization configuration.
S102: when the saving operation exists, judging whether the file or the folder is modified, if not, executing S103; if yes, executing S104; specifically, but not limited to, when a save instruction is received, the last version of the file or folder is compared with the current version of the file or folder stored in the ordinary storage area, and if the last version of the file or folder is the same as the current version of the file or folder, it is determined that no modification exists, and if the last version of the file or folder is different from the current version of the file or folder, it is determined that modification exists. The last version is the version operated by the user, and the current version is the version stored in the common storage area.
S103: replacing the current version with the last version and storing the current version in a common storage area, and keeping the version number unchanged; although the modification is determined not to exist, the operation behavior information can be recorded through the replacement storage, and the operation behavior information can be used for later tracing.
S104: and storing the current version in the version control area, replacing the current version with the last version and storing the current version in the common storage area, and modifying the version number. Preferably, the method further comprises the steps of setting remarks for each version, further distinguishing information of each version, and clicking to store.
Preferably, this embodiment further includes: and generating a version list including remarks, and calling a file or a folder of a corresponding version from the version control area by using the version list. When a user needs to call each previous version, the user only needs to open the version control software, check the version list and call the files or folders of the corresponding version stored before according to the version number and the remark information.
As shown in fig. 2, the present invention secondly provides an embodiment of a mobile storage device with a version control function, which includes a memory 21 and a processor 22, where the memory 21 is used to store a plurality of instructions, and the processor 22 loads the instructions stored in the memory 21 to execute:
initializing a file or a folder needing to be subjected to version control, and storing the current version of the file or the folder in a common storage area;
when the storage operation exists, judging whether the file or the folder is modified, if not, replacing the current version with the last version and storing the current version in the common storage area, and keeping the version number unchanged; if the version number of the current version is not the same as the version number of the current version, the current version is stored in the version control area, the last version is used for replacing the current version and storing the current version in the common storage area, and the version number is modified.
Preferably, the determining whether the file or the folder is modified specifically includes: and comparing the file or the folder of the last version with the file or the folder of the current version, if the file or the folder of the last version is the same, judging that no modification exists, and if the file or the folder of the last version is different, judging that the modification exists.
Preferably, the method further comprises the following steps: and generating a version list including remarks, and calling a file or a folder of a corresponding version from the version control area by using the version list.
As shown in fig. 3, the present invention further provides an embodiment of a mobile storage device with a version control function, including:
an initialization module 301, configured to initialize a file or a folder that needs to be version-controlled, and store a current version of the file or the folder in a common storage area 303;
a version control module 302, configured to determine whether a file or a folder has been modified when a save operation exists, and if not, replace the current version with the last version and store the current version in the ordinary storage area 303, and keep the version number unchanged; if the current version exists, the current version is stored in the version control area 304, the last version is used for replacing the current version and storing the current version in the common storage area 303, and the version number is modified;
a normal storage area 303 for storing normal data and a last version file or folder;
a version control area 304 for storing all versions of files or folders for version control except the last version.
Preferably, the determining whether the file or the folder is modified specifically includes: and comparing the file or the folder of the last version with the file or the folder of the current version, if the file or the folder of the last version is the same, judging that no modification exists, and if the file or the folder of the last version is different, judging that the modification exists.
Preferably, the method further comprises the following steps: and generating a version list including remarks, and calling a file or a folder of a corresponding version from the version control area by using the version list.
The present invention also proposes a non-transitory computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements a mobile storage method with a version control function as described in any one of the above.
The embodiments in the present specification are described in a progressive manner, and the same or similar parts in the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment. The mobile storage medium mentioned in the above embodiments includes but is not limited to: u disk, SSD, mobile hard disk and other mobile storage related media.
As described above, in the embodiments of the mobile storage method, the mobile storage device, and the mobile storage medium with the version control function, two storage areas are provided in the mobile storage medium, and the file or the folder of the last version is stored in the ordinary storage area, so that each of the other past versions of the file or the folder which needs to be version-controlled by user initialization is stored in the version control area, and when the user needs to call another version, only the version control software in the mobile storage medium needs to be opened, and the required version is called through the version list. The embodiment of the invention realizes version control through the mobile storage medium, has simple operation and convenient calling of each version, and fills the blank of hardware for version control.
The above examples are intended to illustrate but not to limit the technical solutions of the present invention. Any modification or partial replacement without departing from the spirit and scope of the present invention should be covered in the claims of the present invention.