[Tutor] Questions (and initial responses) on using version control [Was: Introductory questions on test-driven development and implementing Git version control.]
boB Stepp
robertvstepp at gmail.com
Sat Apr 25 17:30:02 CEST 2015
N.B.: This is a manual recreation of portions of the original thread,
"Introductory questions on test-driven development and implementing
Git version control". The portions included here are those relevant to
the version control. Where "[...]" appears, this indicates I did not
include those portions of the original thread here.
In a message of Fri, 24 Apr 2015 14:09:45 -0500, boB Stepp writes:
[...]
>My wife (A teacher.) has been after me a lot lately to write some
>programs to make her teaching life better. So I would like to start
>one of her projects using TDD from the get-go. Also, this sounds like
>a good time to try to implement using version control software. While
>setting up Vim recently, I had to install Git (In order to get Vundle
>going.). So now I have that to play with. And to throw more fuel onto
>the fire of learning, why not jump into OOP for this project as well?
>It's about time! Plus it will make life with Tkinter a bit better,
>too.
>The project(s) will be coded in Python 3.4 on Windows 7 64-bit on my
>home computer. All projects that I actually complete for my wife will
>be implemented in her classroom, which has quite a variety of hardware
>and OS platforms: lap tops and desk tops, some of which are rather
>old, running Windows XP, Windows 7, and Ubuntu Linux. And possibly
>other combos that I have not been made aware of yet.
[...]
>And what would be the best approach to integrating Git with these
>efforts? Just how often does one commit one's code to the version
>control system? Or do I have some GCEs (Gross Conceptual Errors) here?
>Can Git be set up to automatically keep track of my code as I create
>and edit it?
[...]
>And I would like to have all of that under version control, too. But
>while I am allowed to write my own programs for this CSA, I am not
>allowed to install anything else, strange as this may sound! Since the
>only functional editors in these bare-bones Solaris 10 environments
>are some simplistic default editor that I do not know the name of and
>vi, I long ago gravitated to doing my actual coding on my Windows PC
>(Being careful to save things with Unix line endings.) and FTPing to
>the environments where these programs will actually run. I AM allowed
>to install anything I want (within reason)on my PC. So I am thinking
>install and use Git there?
----------------------------------------------------------------------
In a message of Fri, 24 Apr 2015 at 3:00 PM, Laura Creighton writes:
>In a message of Fri, 24 Apr 2015 14:09:45 -0500, boB Stepp writes:
[...]
>>And what would be the best approach to integrating Git with these
>>efforts? Just how often does one commit one's code to the version
>>control system? Or do I have some GCEs (Gross Conceptual Errors) here?
>>Can Git be set up to automatically keep track of my code as I create
>>and edit it?
>Depending on what you mean by that, the answer is 'no' or 'that is
>exactly what git does, there is no way to _prevent_ this'.
>You have to tell git when you would like to save your work.
>It doesn't work like autosaving in an editor -- hah hah, she has typed
>300 chars now, (or it has been 5 minutes now) time to autosave -- if
>you never tell git to save the work, it will never get saved.
>So what you typically do is write a test, tell git to save it, run the
>test, have it fail, write some more code and run all the tests again,
>have them pass, tell git to save it, write another test ...
>If in the 'write some more code' part, you get the itch 'it would be
>really bad if my laptop died and I lost all this work' you tell git to
>save immediately and keep on going.
>There is a whole other layer about 'how to share your code with other
>people, politely, when several of you are working on the same project
>at one time, but if you are a one man team, you won't have to worry
>about that for a while.
[...]
>>And I would like to have all of that under version control, too. But
>>while I am allowed to write my own programs for this CSA, I am not
>>allowed to install anything else, strange as this may sound! Since the
>>only functional editors in these bare-bones Solaris 10 environments
>>are some simplistic default editor that I do not know the name of and
>>vi, I long ago gravitated to doing my actual coding on my Windows PC
>>(Being careful to save things with Unix line endings.) and FTPing to
>>the environments where these programs will actually run. I AM allowed
>>to install anything I want (within reason)on my PC. So I am thinking
>>install and use Git there?
>Are you absolutely certain that you cannot install git on your bare-bones
>Solaris 10 environments? Or plug in a memory stick and run code from
>there? Because it would make your life so much easier ...
----------------------------------------------------------------------
On Fri., Apr 24, 2015 at 5:03 PM Alan Gauld wrote:
>On 24/04/15 20:09, boB Stepp wrote:
[...]
>> allowed to install anything else, strange as this may sound! Since the
>> only functional editors in these bare-bones Solaris 10 environments
>> are some simplistic default editor that I do not know the name of and
>> vi,
[...]
>And of course it has the original SCCS for source control.
>Which if there's only a few of you is adequate, and easy
>to work with. I used SCCS on several major projects over
>a 10 year period.
----------------------------------------------------------------------
On Fri, Apr 24, 2015 at 5:52 PM, boB Stepp wrote:
>On Fri, Apr 24, 2015 at 5:03 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
[...]
>> And of course it has the original SCCS for source control.
>> Which if there's only a few of you is adequate, and easy
>> to work with. I used SCCS on several major projects over
>> a 10 year period.
>There is just lil ol' me. I will have to research SCCS.
----------------------------------------------------------------------
On Fri, Apr 24, 2015 at 7:36 PM, Steven D'Aprano wrote:
>On Fri, Apr 24, 2015 at 02:09:45PM -0500, boB Stepp wrote:
[...]
>> And what would be the best approach to integrating Git with these
>> efforts? Just how often does one commit one's code to the version
>> control system? Or do I have some GCEs (Gross Conceptual Errors) here?
>> Can Git be set up to automatically keep track of my code as I create
>> and edit it?
>No, that's not how revision control works. You really don't want every
>time you hit save to count as a new revision. That would be ugly.
>Joel Spolsky has a good introduction to Mercurial (hg). Git is slightly
>different, but the fundamentals are more or less equivalent:
>http://hginit.com/
>You can also watch Git For Ages 4 And Up:
>http://www.youtube.com/watch?v=1ffBJ4sVUb4
>The executive summary of how I use version control:
>- work on bite-sized chunks of functionality
>- when the tests all pass, commit the work done
>- push changes to the master repo at least once per day
>The way I use version control on my own is that I have typically use a
>single branch. I rarely have to worry about contributions from others,
>so it's just my changes. Make sure that all the relevent files (source
>code, documentation, tests, images, etc.) are being tracked. Static
>files which never change, like reference materials, should not be.
>Starting from a point where all the tests pass, I decide to work on a
>new feature, or fix a bug. A feature might be something as small as "fix
>the documentation for this function", but *not* as big as "control
>remote controlled space ship" -- in other words, a bite-sized chunk of
>work, not a full meal. I write some tests, and write the minimal amount
>of code code that makes those tests pass:
>- write tests
>- save tests
>- write code
>- save code
>- run tests
>- fix bugs in tests
>- save tests
>- write some more code
>- save code
>- run tests again
>- write some more code
>- save code
>- run tests again
>etc. Once the tests pass, then I have a feature and/or bug fix, and I
>commit all the relevent changes to the VCS. hg automatically tracks
>files, git requires you to remind it every single time what files are
>being used, but either way, by the time I run `hg commit` or `git
>commit` I have a complete, and hopefully working, bite-sized chunk of
>code that has an obvious commit message:
>"fix bug in spam function"
>"correct spelling errors in module docs"
>"rename function ham to spam"
>"change function eggs from using a list to a dict"
>"move class K into its own submodule"
>etc. Notice that each change is small enough to encapsulate in a short
>description, but big enough that some of them may require multiple
>rounds of back-and-forth code-and-test before it works.
>I run the tests even after seemingly innoculous changes to comments or
>docstrings, especially docstrings. Edits to a docstring may break your
>doctests, or even your code, if you accidentally break the quoting.
>Then, when I am feeling satisfied that I've done a sufficiently large
>amount of work, I then push those changes to the master repo (if any).
>This allows me to work from various computers and still share the same
>code base. "Sufficiently large" may mean a single change, or a full
>day's work, or a whole lot of related changes that add up to one big
>change, whatever you prefer. But it shouldn't be less than once per day.
[...]
>> And I would like to have all of that under version control, too. But
>> while I am allowed to write my own programs for this CSA, I am not
>> allowed to install anything else, strange as this may sound! Since the
>> only functional editors in these bare-bones Solaris 10 environments
>> are some simplistic default editor that I do not know the name of and
>> vi, I long ago gravitated to doing my actual coding on my Windows PC
>> (Being careful to save things with Unix line endings.) and FTPing to
>> the environments where these programs will actually run. I AM allowed
>> to install anything I want (within reason)on my PC. So I am thinking
>> install and use Git there?
>Yes.
----------------------------------------------------------------------
On Fri, Apr 24, 2015 at 7:46 PM, Alan Gauld wrote:
>On 24/04/15 23:52, boB Stepp wrote:
>> There is just lil ol' me. I will have to research SCCS.
>SCCS is great for a single, small team. It's marginally more complex
>than more modern tools and it only works sensibly with text files
>(binaries are just uuencoded which is pretty pointless!).
>Basic usage is very simple:
>1) create an SCCS directory in your project space - or you wind up
> with version files all over the place!
>2) use the admin -i command to tell sccs to manage a file
>3) use get to get a read only copy or get -e to get an editable one.
> (use -r to get a specific version)
>4) use delta to save changes (it prompts you for change comments etc)
>There are a bunch of other reporting and searching and admin
>commands, but the above is all you need 90% of the time.
>More modern versioning systems are better but SCCS should already
>be installed on Solaris 10 if you have the development tools
>installed, which I'm guessing you do or pretty much
>nothing code-wise would work.
----------------------------------------------------------------------
On Fri, Apr 24, 2015 at 8:24 PM, boB Stepp wrote:
>On Fri, Apr 24, 2015 at 3:00 PM, Laura Creighton <lac at openend.se> wrote:
>> In a message of Fri, 24 Apr 2015 14:09:45 -0500, boB Stepp writes:
[...]
>>>And I would like to have all of that under version control, too. But
>>>while I am allowed to write my own programs for this CSA, I am not
>>>allowed to install anything else, strange as this may sound! Since the
>>>only functional editors in these bare-bones Solaris 10 environments
>>>are some simplistic default editor that I do not know the name of and
>>>vi, I long ago gravitated to doing my actual coding on my Windows PC
>>>(Being careful to save things with Unix line endings.) and FTPing to
>>>the environments where these programs will actually run. I AM allowed
>>>to install anything I want (within reason)on my PC. So I am thinking
>>>install and use Git there?
>>
>> Are you absolutely certain that you cannot install git on your bare-bones
>> Solaris 10 environments? Or plug in a memory stick and run code from
>> there? Because it would make your life so much easier ...
>I think that I can get an exception here (See a post in response that
>I made earlier today.). What I am *certain* of, is that I cannot
>install anything on our clinical planning environment. The Solaris
>workstation that I now have all to myself--I'm thinking they will now
>let me do what I want with it. But I must double check... But anything
>I develop there *should* work in the clinical environment. The
>planning software is the same though that may change soon as there are
>plans to go up a version and they may not want to do that on my
>testing/development machine.
----------------------------------------------------------------------
More information about the Tutor
mailing list