Skip to content

Commit 980e9ec

Browse files
committed
Merge branch 'develop'
Release 0.3: - General bug fixes. - UI improvements (made some messages more clear, consistent). - Allow the user to branch out from certain commit point. - Improvements in gl diff: now it outputs a message if the file is ignored or if there are no diffs to show. - pre-commit hooks now work fine.
2 parents 2802b9e + c775748 commit 980e9ec

30 files changed

+1344
-580
lines changed

README.md

+34-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ More info, downloads and documentation @
1212
About
1313
-----
1414

15-
Gitless is an experimental version control system built on top of Git. We are
16-
exploring what conceptual integrity means with the goal of building a rigorous
17-
foundation for concept design. We encourage you to try out the current version
18-
of Gitless and send feedback. Keep in mind that Gitless might change in
19-
non-retrocompatible ways (so don't script around it just yet) as we seek to
20-
answer the fundamental question that drives this software project: if we were
21-
to challenge the very core concepts in version control systems, what would
22-
version control look like?
15+
Gitless is an experimental version control system built on top of Git. Keep in
16+
mind that Gitless might change in non-retrocompatible ways (so don't script
17+
around it just yet) as we seek to answer the fundamental question that drives
18+
this software project: if we were to challenge the very core concepts in
19+
version control systems, what would version control look like?
2320

2421
In its current state, Gitless is a distributed version control system that
2522
supports all of the most commonly used Git features. We are missing some things
@@ -40,3 +37,32 @@ Documentation
4037
-------------
4138

4239
TODO
40+
41+
42+
Installing
43+
----------
44+
45+
Note that the installation **won't interfere** with your Git installation in any
46+
way, you can keep using Git, and switch between Git and Gitless seamleslly.
47+
48+
You need to have Python and Git installed. If you don't, search for their
49+
official websites, install them and come back.
50+
51+
The easiest way to install Gitless is using the Python Package Manager `pip`. If
52+
you don't have `pip`, just search the web for it, and you'll find installation
53+
instructions on their website. Now, once you have `pip` installed just do:
54+
55+
$> pip install gitless
56+
57+
You should now be able to start executing the `gl` command.
58+
59+
60+
61+
Contributing
62+
------------
63+
64+
We only have two branches, `master` and `develop`. We code in `develop` and
65+
merge the changes onto `master` when the changes are stable and we're ready to
66+
cut a new release. So you'll find on `develop` the latest changes.
67+
68+
To contribute: fork project, make changes, send pull request.

RELEASE_NOTES.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Gitless's Release Notes
22
=======================
33

4+
28th Oct 2013 - kendall.0.3
5+
---------------------------
6+
7+
* General bug fixes.
8+
* UI improvements (made some messages more clear, consistent).
9+
* Allow the user to branch out from certain commit point.
10+
* Improvements in gl diff: now it outputs a message if the file is ignored or if
11+
there are no diffs to show.
12+
* pre-commit hooks now work fine.
13+
14+
415
4th Sept 2013 - kendall.0.2.1
516
-----------------------------
617

gitless/cli/commit_dialog.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ def _show(files):
4949
pprint.sep(p=cf.write)
5050
pprint.msg(
5151
'Please enter the commit message for your changes above. Lines starting '
52-
'with \'#\' will be ignored, and an empty message aborts the commit.',
52+
'with', p=cf.write)
53+
pprint.msg(
54+
'\'#\' will be ignored, and an empty message aborts the commit.',
5355
p=cf.write)
56+
pprint.blank(p=cf.write)
5457
pprint.msg('These are the files that will be commited:', p=cf.write)
5558
pprint.exp('You can add/remove files to this list', p=cf.write)
5659
for f in files:
@@ -142,7 +145,9 @@ def _extract_info():
142145
msg += l
143146
l = cf.readline()
144147
# We reached the separator, this marks the end of the commit msg.
145-
# We exhaust the two following lines so that we get to the file list.
148+
# We exhaust the following lines so that we get to the file list.
149+
cf.readline()
150+
cf.readline()
146151
cf.readline()
147152
cf.readline()
148153
cf.readline()

gitless/cli/file_cmd.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Gitless - a version control system built on top of Git.
2+
# Copyright (c) 2013 Santiago Perez De Rosso.
3+
# Licensed under GNU GPL, version 2.
4+
5+
"""Helper module for gl_{track, untrack, resolve}."""
6+
7+
8+
import pprint
9+
10+
from gitless.core import file as file_lib
11+
12+
13+
VOWELS = ('a', 'e', 'i', 'o', 'u')
14+
15+
16+
def parser(help_msg, subcmd):
17+
def f(subparsers):
18+
p = subparsers.add_parser(
19+
subcmd, help=help_msg)
20+
p.add_argument(
21+
'files', nargs='+', help='the file(s) to {}'.format(subcmd))
22+
p.set_defaults(func=main(subcmd))
23+
return f
24+
25+
26+
def main(subcmd):
27+
def f(args):
28+
success = True
29+
30+
for fp in args.files:
31+
ret = getattr(file_lib, subcmd)(fp)
32+
if ret == file_lib.FILE_NOT_FOUND:
33+
pprint.err('Can\'t {} a non-existent file: {}'.format(subcmd, fp))
34+
success = False
35+
elif ret is file_lib.FILE_ALREADY_UNTRACKED:
36+
pprint.err('File {} is already untracked'.format(fp))
37+
success = False
38+
elif ret is file_lib.FILE_ALREADY_TRACKED:
39+
pprint.err('File {} is already tracked'.format(fp))
40+
success = False
41+
elif ret is file_lib.FILE_IS_IGNORED:
42+
pprint.err('File {} is ignored. Nothing to {}'.format(fp, subcmd))
43+
pprint.err_exp(
44+
'edit the .gitignore file to stop ignoring file {}'.format(fp))
45+
success = False
46+
elif ret is file_lib.FILE_IN_CONFLICT:
47+
pprint.err('Can\'t {} a file in conflict'.format(subcmd))
48+
success = False
49+
elif ret is file_lib.FILE_NOT_IN_CONFLICT:
50+
pprint.err('File {} has no conflicts'.format(fp))
51+
success = False
52+
elif ret is file_lib.FILE_ALREADY_RESOLVED:
53+
pprint.err(
54+
'Nothing to resolve. File {} was already marked as resolved'.format(
55+
fp))
56+
success = False
57+
elif ret is file_lib.SUCCESS:
58+
pprint.msg(
59+
'File {} is now a{} {}{}d file'.format(
60+
fp, 'n' if subcmd.startswith(VOWELS) else '', subcmd,
61+
'' if subcmd.endswith('e') else 'e'))
62+
else:
63+
raise Exception('Unexpected return code {}'.format(ret))
64+
65+
return success
66+
return f

gitless/cli/gl.py

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
def main():
4040
parser = argparse.ArgumentParser()
41+
parser.add_argument('--version', action='version', version=GL_VERSION)
4142
subparsers = parser.add_subparsers(dest='subcmd_name')
4243

4344
sub_cmds = {

gitless/cli/gl_branch.py

+19-12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def parser(subparsers):
1818
branch_parser.add_argument(
1919
'branch', nargs='?',
2020
help='switch to branch (will be created if it doesn\'t exist yet)')
21+
branch_parser.add_argument(
22+
'divergent_point', nargs='?',
23+
help='the commit from where to \'branch out\' (only relevant if a new '
24+
'branch is created; defaults to HEAD)', default='HEAD')
2125
branch_parser.add_argument(
2226
'-d', '--delete', nargs='+', help='delete branch(es)', dest='delete_b')
2327
branch_parser.add_argument(
@@ -28,8 +32,8 @@ def parser(subparsers):
2832

2933
def main(args):
3034
if args.branch:
31-
exists, is_current, unused_tracks = branch_lib.status(args.branch)
32-
if exists and is_current:
35+
b_st = branch_lib.status(args.branch)
36+
if b_st.exists and b_st.is_current:
3337
pprint.err(
3438
'You are already in branch %s. No need to switch.' % args.branch)
3539
pprint.err_exp('to list existing branches do gl branch')
@@ -47,11 +51,14 @@ def main(args):
4751
'-- this will be implemented in the future)')
4852
return False
4953

50-
if not exists:
51-
ret = branch_lib.create(args.branch)
54+
if not b_st.exists:
55+
ret = branch_lib.create(args.branch, dp=args.divergent_point)
5256
if ret is branch_lib.INVALID_NAME:
5357
pprint.err('Invalid branch name')
5458
return False
59+
elif ret == branch_lib.INVALID_DP:
60+
pprint.msg('Invalid divergent point {}'.format(args.divergent_point))
61+
return False
5562
elif ret is branch_lib.SUCCESS:
5663
pprint.msg('Created new branch %s' % args.branch)
5764
else:
@@ -77,11 +84,11 @@ def _do_list():
7784
'use gl branch -su <upstream> to set an upstream for the current branch')
7885
pprint.exp('* = current branch')
7986
pprint.blank()
80-
for name, is_current, upstream, upstream_in_remote in branch_lib.status_all():
87+
for name, is_current, upstream, upstream_exists in branch_lib.status_all():
8188
current_str = '*' if is_current else ' '
8289
upstream_str = ''
8390
if upstream:
84-
np_str = ' --not present in remote yet' if not upstream_in_remote else ''
91+
np_str = ' --not present in remote yet' if not upstream_exists else ''
8592
upstream_str = '(upstream is %s%s)' % (upstream, np_str)
8693
pprint.item('%s %s %s' % (current_str, name, upstream_str))
8794

@@ -90,12 +97,12 @@ def _do_delete(delete_b):
9097
errors_found = False
9198

9299
for b in delete_b:
93-
exists, is_current, unused_tracks = branch_lib.status(b)
94-
if not exists:
100+
b_st = branch_lib.status(b)
101+
if not b_st.exists:
95102
pprint.err('Can\'t remove non-existent branch %s' % b)
96103
pprint.err_exp('to list existing branches do gl branch')
97104
errors_found = True
98-
elif exists and is_current:
105+
elif b_st.exists and b_st.is_current:
99106
pprint.err('Can\'t remove current branch %s' % b)
100107
pprint.err_exp(
101108
'use gl branch <b> to create or switch to another branch b and then '
@@ -115,11 +122,11 @@ def _do_set_upstream(upstream):
115122
pprint.err(
116123
'Invalid upstream branch. It must be in the format remote/branch')
117124
return True
118-
upstream_remote, upstream_branch = upstream.split('/')
119125

120-
ret = branch_lib.set_upstream(upstream_remote, upstream_branch)
121-
errors_found = False
126+
ret = branch_lib.set_upstream(upstream)
122127

128+
errors_found = False
129+
upstream_remote, upstream_branch = upstream.split('/')
123130
if ret is branch_lib.REMOTE_NOT_FOUND:
124131
pprint.err('Remote %s not found' % upstream_remote)
125132
pprint.err_exp('do gl remote show to list all available remotes')

gitless/cli/gl_checkout.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"""gl checkout - Checkout committed versions of files."""
66

77

8-
import os
9-
108
from gitless.core import file as file_lib
119

1210
import pprint
@@ -47,7 +45,9 @@ def _checkout_file(fp, cp):
4745
conf_msg = (
4846
'You have uncomitted changes in %s that could be overwritten by the '
4947
'checkout' % fp)
50-
if file_lib.is_tracked_modified(fp) and not pprint.conf_dialog(conf_msg):
48+
f = file_lib.status(fp)
49+
if f.type == file_lib.TRACKED and f.modified and not pprint.conf_dialog(
50+
conf_msg):
5151
pprint.err('Checkout aborted')
5252
return False
5353

0 commit comments

Comments
 (0)