simple-vcs 1.0.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simple_vcs/__init__.py +10 -10
- simple_vcs/cli.py +145 -53
- simple_vcs/core.py +569 -276
- simple_vcs-1.2.0.dist-info/METADATA +352 -0
- simple_vcs-1.2.0.dist-info/RECORD +10 -0
- {simple_vcs-1.0.0.dist-info → simple_vcs-1.2.0.dist-info}/WHEEL +1 -1
- simple_vcs-1.0.0.dist-info/METADATA +0 -278
- simple_vcs-1.0.0.dist-info/RECORD +0 -10
- {simple_vcs-1.0.0.dist-info → simple_vcs-1.2.0.dist-info}/entry_points.txt +0 -0
- {simple_vcs-1.0.0.dist-info → simple_vcs-1.2.0.dist-info}/licenses/LICENSE +0 -0
- {simple_vcs-1.0.0.dist-info → simple_vcs-1.2.0.dist-info}/top_level.txt +0 -0
simple_vcs/__init__.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"""
|
|
2
|
-
SimpleVCS - A simple version control system
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
__version__ = "1.
|
|
6
|
-
__author__ = "
|
|
7
|
-
|
|
8
|
-
from .core import SimpleVCS
|
|
9
|
-
|
|
10
|
-
__all__ = ["SimpleVCS"]
|
|
1
|
+
"""
|
|
2
|
+
SimpleVCS - A simple version control system
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
__version__ = "1.1.0"
|
|
6
|
+
__author__ = "Muhammad Sufiyan Baig"
|
|
7
|
+
|
|
8
|
+
from .core import SimpleVCS
|
|
9
|
+
|
|
10
|
+
__all__ = ["SimpleVCS"]
|
simple_vcs/cli.py
CHANGED
|
@@ -1,54 +1,146 @@
|
|
|
1
|
-
import click
|
|
2
|
-
from .core import SimpleVCS
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@main.command()
|
|
18
|
-
@click.
|
|
19
|
-
def
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
vcs
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import click
|
|
2
|
+
from .core import SimpleVCS
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
|
|
5
|
+
console = Console()
|
|
6
|
+
|
|
7
|
+
@click.group()
|
|
8
|
+
@click.version_option(version="1.2.0", prog_name="SimpleVCS")
|
|
9
|
+
def main():
|
|
10
|
+
"""
|
|
11
|
+
SimpleVCS - A beautiful and simple version control system
|
|
12
|
+
|
|
13
|
+
A lightweight VCS with an intuitive interface for managing your project versions.
|
|
14
|
+
"""
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
@main.command()
|
|
18
|
+
@click.option('--path', default='.', help='Path where repository will be created')
|
|
19
|
+
def init(path):
|
|
20
|
+
"""Initialize a new SimpleVCS repository
|
|
21
|
+
|
|
22
|
+
Creates a new .svcs directory with all necessary files for version control.
|
|
23
|
+
|
|
24
|
+
Example: svcs init --path ./my-project
|
|
25
|
+
"""
|
|
26
|
+
vcs = SimpleVCS(path)
|
|
27
|
+
vcs.init_repo()
|
|
28
|
+
|
|
29
|
+
@main.command()
|
|
30
|
+
@click.argument('files', nargs=-1, required=True)
|
|
31
|
+
def add(files):
|
|
32
|
+
"""Add files to the staging area
|
|
33
|
+
|
|
34
|
+
Stage files to be included in the next commit. You can add multiple files at once.
|
|
35
|
+
|
|
36
|
+
Example: svcs add file1.txt file2.py
|
|
37
|
+
"""
|
|
38
|
+
vcs = SimpleVCS()
|
|
39
|
+
for file in files:
|
|
40
|
+
vcs.add_file(file)
|
|
41
|
+
|
|
42
|
+
@main.command()
|
|
43
|
+
@click.option('-m', '--message', help='Commit message describing the changes')
|
|
44
|
+
def commit(message):
|
|
45
|
+
"""Commit staged changes to the repository
|
|
46
|
+
|
|
47
|
+
Creates a new commit with all staged files. If no message is provided,
|
|
48
|
+
an automatic timestamp-based message will be generated.
|
|
49
|
+
|
|
50
|
+
Example: svcs commit -m "Add new feature"
|
|
51
|
+
"""
|
|
52
|
+
vcs = SimpleVCS()
|
|
53
|
+
vcs.commit(message)
|
|
54
|
+
|
|
55
|
+
@main.command()
|
|
56
|
+
@click.option('--c1', type=int, help='First commit ID (defaults to second-last commit)')
|
|
57
|
+
@click.option('--c2', type=int, help='Second commit ID (defaults to last commit)')
|
|
58
|
+
def diff(c1, c2):
|
|
59
|
+
"""Show differences between commits
|
|
60
|
+
|
|
61
|
+
Compare files between two commits to see what changed. Without arguments,
|
|
62
|
+
compares the last two commits.
|
|
63
|
+
|
|
64
|
+
Example: svcs diff --c1 1 --c2 3
|
|
65
|
+
"""
|
|
66
|
+
vcs = SimpleVCS()
|
|
67
|
+
vcs.show_diff(c1, c2)
|
|
68
|
+
|
|
69
|
+
@main.command()
|
|
70
|
+
@click.option('--limit', type=int, help='Maximum number of commits to display')
|
|
71
|
+
def log(limit):
|
|
72
|
+
"""Show commit history
|
|
73
|
+
|
|
74
|
+
Display a beautiful table of all commits with their messages, dates, and files.
|
|
75
|
+
Use --limit to show only recent commits.
|
|
76
|
+
|
|
77
|
+
Example: svcs log --limit 10
|
|
78
|
+
"""
|
|
79
|
+
vcs = SimpleVCS()
|
|
80
|
+
vcs.show_log(limit)
|
|
81
|
+
|
|
82
|
+
@main.command()
|
|
83
|
+
def status():
|
|
84
|
+
"""Show current repository status
|
|
85
|
+
|
|
86
|
+
Display information about the repository including current commit,
|
|
87
|
+
total commits, and staged files ready for commit.
|
|
88
|
+
|
|
89
|
+
Example: svcs status
|
|
90
|
+
"""
|
|
91
|
+
vcs = SimpleVCS()
|
|
92
|
+
vcs.status()
|
|
93
|
+
|
|
94
|
+
@main.command()
|
|
95
|
+
@click.argument('commit_id', type=int)
|
|
96
|
+
def revert(commit_id):
|
|
97
|
+
"""Revert to a specific commit
|
|
98
|
+
|
|
99
|
+
Quickly restore your repository to a previous commit state.
|
|
100
|
+
All files will be restored to their state at that commit.
|
|
101
|
+
|
|
102
|
+
Example: svcs revert 3
|
|
103
|
+
"""
|
|
104
|
+
vcs = SimpleVCS()
|
|
105
|
+
vcs.quick_revert(commit_id)
|
|
106
|
+
|
|
107
|
+
@main.command()
|
|
108
|
+
@click.option('--name', help='Custom name for the snapshot (optional)')
|
|
109
|
+
def snapshot(name):
|
|
110
|
+
"""Create a compressed snapshot
|
|
111
|
+
|
|
112
|
+
Creates a ZIP archive of your entire repository (excluding .svcs directory).
|
|
113
|
+
Perfect for backups or sharing your project.
|
|
114
|
+
|
|
115
|
+
Example: svcs snapshot --name my-backup
|
|
116
|
+
"""
|
|
117
|
+
vcs = SimpleVCS()
|
|
118
|
+
vcs.create_snapshot(name)
|
|
119
|
+
|
|
120
|
+
@main.command()
|
|
121
|
+
@click.argument('snapshot_path', type=click.Path(exists=True))
|
|
122
|
+
def restore(snapshot_path):
|
|
123
|
+
"""Restore from a snapshot
|
|
124
|
+
|
|
125
|
+
Restore your repository from a previously created snapshot ZIP file.
|
|
126
|
+
Current files will be replaced with snapshot contents.
|
|
127
|
+
|
|
128
|
+
Example: svcs restore snapshot_12345.zip
|
|
129
|
+
"""
|
|
130
|
+
vcs = SimpleVCS()
|
|
131
|
+
vcs.restore_from_snapshot(snapshot_path)
|
|
132
|
+
|
|
133
|
+
@main.command()
|
|
134
|
+
def compress():
|
|
135
|
+
"""Compress stored objects
|
|
136
|
+
|
|
137
|
+
Optimize repository storage by compressing object files.
|
|
138
|
+
Helps save disk space without losing any data.
|
|
139
|
+
|
|
140
|
+
Example: svcs compress
|
|
141
|
+
"""
|
|
142
|
+
vcs = SimpleVCS()
|
|
143
|
+
vcs.compress_objects()
|
|
144
|
+
|
|
145
|
+
if __name__ == '__main__':
|
|
54
146
|
main()
|