dalehenrich / FSGit

Git FileSystem implementation
http://www.squeaksource.com/FSGit.html
7 stars 0 forks source link

`Metacello git`? #15

Open dalehenrich opened 12 years ago

dalehenrich commented 12 years ago

While thinking about using git in Smalltalk this morning it occurred to me that there is a natural way to integrate git into Metacello using Metacello git and executing commands like the following:

Metacello git
  project: 'Metacello';
  repository: 'git://github.com/dalehenrich/metacello-work.git';
  load "which does a clone of the repository  and then a load from the repo"
Metacello git
  project: 'Metacello';
  cherryPick: '-x -n 0b0165a620c433341601cac5ee01888f40c44c66'
Metacello git
  project: 'Metacello';
  pull: `origin master'
Metacello git
  project: 'Metacello';
  status
Metacello git
  project: 'Metacello';
  log
Metacello git
  project: 'Metacello';
  diff
Metacello git
  project: 'Metacello';
  commit: '-a -m"this is a commit comment"'

Not sure how that I like the command line arg passing, but it sure maps directly to the git documentation which is a real plus ... we could write a little argument parser to pick apart the command line and turn it into proper Smalltalk message sends underneath th covers.

We could do something like:

Metacello git
  project: 'Metacello';
  a;
  m: 'this is a commit comment';
  commit

but then positioinal args would be difficult to handle ... not sure how to map the following to proper Smalltalk:

Metacello git
  project: 'Metacello';
  pull: 'origin master'

Anyway, some food for thought ...

camillobruni commented 12 years ago

I think this would be a good way to go, with very little resistance :). I mean we could even map the commands onto the real git command-line using OSProcess which should work out of the box.

dalehenrich commented 12 years ago

When a checkout is done (explicit or implied ... pull, cherry-pick, etc.) we can immediately do a Metacello load (if there are no outstanding conflicts) ...

frankshearar commented 12 years ago

#pull: is simple, I would have thought:

pull: remoteName
    ^ self pull: remoteName branch: 'master'.

pull: remoteName branch: branchName
    "Stuff here"

Be sure to take a look at Gitocello which already (through FFI) wraps a goodly chunk of git.

dalehenrich commented 12 years ago

woops ... I replied out of context (so I deleted the previous comment:).

You are correct that:

git pull --no-commit --no-ff -v origin master 

could be mapped to:

Metacello git
  project: 'Metacello';
  noCommit;
  noFf;
  v;
  pull: 'origin' branch: 'master'

Besides the fact that we cannot exactly duplicate the script commands (issues with arg names and ordering), I question the usefulness of inventing a new language for git when the existing shell commands are so prevalent. I lean towards the following:

Metacello git
  project: 'Metacello';
  pull: '--no-commit --no-ff -v origin master'

primarily because it is google-friendly ... Being able to copy an example verbatim from stack-overflow to your script is extremely important!

ltrutter commented 12 years ago

+1

-Larry Trutter Sent from my phone

----- Reply message ----- From: "Dale Henrichs" notifications@github.com To: "dalehenrich/FSGit" FSGit@noreply.github.com Subject: [FSGit] Metacello git? (#15) Date: Fri, Sep 14, 2012 9:56 am woops ... I replied out of context (so I deleted the previous comment:).

You are correct that:

git pull --no-commit --no-ff -v origin master

could be mapped to:

Metacello git project: 'Metacello'; noCommit; noFf; v; pull: `origin' branch: 'master'

Besides the fact that we cannot exactly duplicate the script commands (issues with arg names and ordering), I question the usefulness of inventing a new language for git when the existing shell commands are so prevalent. I lean towards the following:

Metacello git project: 'Metacello'; pull: `--no-commit --no-ff -v origin master'

primarily because it is google-friendly ... Being able to copy an example verbatim from stack-overflow to your script is extremely important!

Reply to this email directly or view it on GitHub.