Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Version Control System

A lightweight, efficient file version control system implemented in C++ that allows you to track changes to individual files. This project implements a skip list data structure for efficient version management, providing O(log n) average time complexity for most operations.

Features

  • Efficient Version Management: Uses skip list data structure for O(log n) operations
  • File Versioning: Track changes to individual files with version numbers
  • Version Comments: Add descriptive comments to each version
  • Content Preview: View version contents with optional preview mode
  • Backup System: Automatic backup of original files
  • Command-line Interface: Easy-to-use interactive CLI

Technical Implementation

Core Components

  1. Skip List Implementation

    • Template-based implementation for type flexibility
    • Probabilistic balancing for optimal performance
    • Average O(log n) complexity for insert, search, and delete operations
  2. Version Management

    • Automatic version numbering
    • Timestamp tracking
    • Comment support
    • Content storage and retrieval
  3. File Operations

    • Automatic file backup
    • Safe file operations with error handling
    • Content verification

Building and Running

Prerequisites

  • C++17 compatible compiler
  • Make sure you have g++ installed

Build Instructions

  1. Clone the repository
  2. Run the build script:
./build_and_run.sh

Usage

Available Commands

  • init <filename> - Initialize version control for a file
  • save [comment] - Save current state as a new version (optional comment)
  • list [--preview] - List all versions (--preview shows content previews)
  • restore <version> - Restore to a specific version number
  • view <version> - View the full content of a specific version
  • delete <version> - Delete a specific version
  • latest - Restore to the latest version
  • backup - Restore from original backup
  • help - Show help message
  • exit - Quit the program

Example Usage

# Initialize version control for a file
> init myfile.txt

# Save a new version with comment
> save "Added new feature"

# List all versions
> list

# List versions with content previews
> list --preview

# Restore to a specific version
> restore 2

# View specific version content
> view 2

Project Structure

.
├── SkipList.hpp         # Skip list data structure implementation
├── Version.hpp          # Version class definition
├── FileVersionManager.hpp # Version management implementation
├── main.cpp            # CLI implementation
├── build_and_run.sh    # Build script
└── README.md           # This file

Technical Details

Skip List Implementation

  • Maximum level: 16 (suitable for large number of versions)
  • Probability factor: 0.5 (balanced performance)
  • Space complexity: O(n)
  • Average time complexity: O(log n)

Version Storage

  • Version number
  • Timestamp
  • File content
  • Optional comment
  • Content preview capability

Error Handling

The system includes comprehensive error handling for:

  • File operations
  • Invalid version numbers
  • Memory management
  • User input validation

Future Enhancements

Potential areas for future development:

  1. Diff viewing between versions
  2. Branch support
  3. Network synchronization
  4. Compression for storage optimization
  5. GUI interface

Contributing

Feel free to contribute to this project by:

  1. Reporting issues
  2. Suggesting enhancements
  3. Creating pull requests

License

This project is open source and available under the MIT License.

Author

Ashish Kaushik

Acknowledgments

  • Inspired by modern version control systems
  • Built using efficient data structures and algorithms
  • Designed for educational and practical purposes

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages