-
Notifications
You must be signed in to change notification settings - Fork 5
/
README
116 lines (84 loc) · 2.89 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
NAME
GitStore - Git as versioned data store in Perl
SYNOPSIS
use GitStore;
my $gs = GitStore->new('/path/to/repo');
$gs->set( 'users/obj.txt', $obj );
$gs->set( ['config', 'wiki.txt'], { hash_ref => 1 } );
$gs->commit();
$gs->set( 'yyy/xxx.log', 'Log me' );
$gs->discard();
# later or in another pl
my $val = $gs->get( 'user/obj.txt' ); # $val is the same as $obj
my $val = $gs->get( 'config/wiki.txt' ); # $val is { hashref => 1 } );
my $val = $gs->get( ['yyy', 'xxx.log' ] ); # $val is undef since discard
DESCRIPTION
It is inspired by the Python and Ruby binding. check SEE ALSO
METHODS
new
GitStore->new('/path/to/repo');
GitStore->new( repo => '/path/to/repo', branch => 'mybranch' );
GitStore->new( repo => '/path/to/repo', author => 'Someone Unknown <unknown\@what.com>' );
repo
your git dir (without .git)
branch
your branch name, default is 'master'
author
It is used in the commit info
set($path, $val)
$gs->set( 'yyy/xxx.log', 'Log me' );
$gs->set( ['config', 'wiki.txt'], { hash_ref => 1 } );
$gs->set( 'users/obj.txt', $obj );
Store $val as a $path file in Git
$path can be String or ArrayRef
$val can be String or Ref[HashRef|ArrayRef|Ref[Ref]] or blessed Object
get($path)
$gs->get( 'user/obj.txt' );
$gs->get( ['yyy', 'xxx.log' ] );
Get $val from the $path file
$path can be String or ArrayRef
delete($path)
remove($path)
remove $path from Git store
commit
$gs->commit();
$gs->commit('Your Comments Here');
commit the set changes into Git
discard
$gs->discard();
discard the set changes
FAQ
why the files are not there?
run
git checkout
any example?
# if you just need a local repo, that's all you need.
mkdir sandbox
cd sandbox
git init
# use GitStore->new('/path/to/this/sandbox')
# set something
git checkout
# follows are for remote git url
git remote add origin [email protected]:fayland/sandbox2.git
git push origin master
# do more GitStore->new('/path/to/this/sandbox') later
git checkout
git pull origin master
git push
SEE ALSO
Article
<http://www.newartisans.com/2008/05/using-git-as-a-versioned-data-st
ore-in-python.html>
Python binding
<http://github.com/jwiegley/git-issues/tree/master>
Ruby binding
<http://github.com/georgi/git_store/tree/master>
Git URL
<http://github.com/fayland/perl-git-store/tree/master>
AUTHOR
Fayland Lam, "<fayland at gmail.com>"
COPYRIGHT & LICENSE
Copyright 2009 Fayland Lam, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.