Discussion:
[fonc] maru questions
Attila Lendvai
2014-01-20 11:03:12 UTC
Permalink
dear list,

are the following assertions correct? any insights on them?

the eval.c, eval2.c, and eval3.c are a linear progression, similar to
how VCS versions of the same file follow each other as they evolve?
(in the current repo eval.c was not changed a single time after
eval2.c has been introduced.) this also applies to some other files
like boot.l and boot2.l, that are tightly coupled with eval.

the reason they are retained with explicit names in the repo is to be
able to easily compare the old versions for speed, compatibility and
some similar comparative operations?

it wouldn't be needed if there were some makefile targets, or some
other easy way, that checked out specific old revisions from the repo
and built them, so that experiments could be made with both the
executables yielded by building the current repo state and yielded by
building older states?

---

if these are all true above, then i'll look into implementing that
last one. basically there could be git branches like 'bootstrap-1',
'bootstrap-2', etc... the idea is that the compiler code in the
'bootstrap-n' branch requires the eval.exe yielded by building the
code in 'bootstrap-(n-1)'.

if you want to bootstrap from the first hand written eval.c, which is
potentially missing countless recent features, then you need a script
that goes through all the bootstrap stages and builds the eval.exe's
in succession. if bugs or platform issues show up in the process, then
you can just push fixes to the appropriate branches and restart.

if a new compiler is introduced later that can e.g. emit portable C
code, then the emitted code could be checked into the appropriate
bootstrap branch and then the C->bleeding-edge bootstrap process could
be shortened.

e.g. in the current state of maru, the bootstrap-from-C process could
start from the 'bootstrap-2' branch that would hold eval2.c and
boot2.l (because the current eval2.c is still written by hand and
doesn't depend on eval1).

this change would imply that the build process becomes somewhat
dependent on the repo format. due to the excellent teamwork goodies
provided by github, and the social trends, git seems like a good
choice. but given that Ian uses hg, and that it also has branches,
that's a big weight that i'm willing to give in to easily. (if i was
alone on the planet then i'd go with darcs and tags, but i am not, and
one of the main points of my current effort is to bring life into maru
hacking)

there's also http://hg-git.github.io/ which means that the hg client
can push into git repos, which may mean the best of both worlds: i
record whatever i do in hg, push to github for collaboration, and
publish my repo for Ian to be able to pull from it. but how well that
works needs to be investigated, unless someone has experience with it.

any thoughts? Ian?
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“We will have taken one giant step forward when we face this reality:
Powerful people never teach powerless people how to take their power
away from them.”
— John Henrik Clarke (1915–1998)
Attila Lendvai
2014-01-21 10:00:14 UTC
Permalink
Post by Attila Lendvai
there's also http://hg-git.github.io/ which means that the hg client
can push into git repos, which may mean the best of both worlds: i
update: i've looked into this and it seems manageable. the result of a
proof-of-concept workflow is available here:

https://github.com/attila-lendvai/maru-hg-git-experiment
https://bitbucket.org/attila-lendvai/maru/

the github repo is pushed from a local maru hg repo with the hg-git
plugin enabled. in my local hg repo i've recorded some new commits
relative to the official hg repo. these commits separate the eval1,
eval2, and eval3 into separate bookmarks/branches called 'stage-n'.

the hg repo at bitbucket.org has the hg stage-n bookmarks.

when i 'hg push github', the hg bookmarks are synced with git
branches. (hg branches, as opposed to bookmarks, are following a
different model than git, and are also becoming less and less used)

i'll attach my notes at the end of my mail, maybe it's useful to
someone.

even though this workflow is manageable, all in all i think it's not
worth the trouble. practically i'm doing with hg bookmarks what i'd be
doing with git branches, except that the mercurial tools seem to be
less numerous and less developed. and the complexity bookmarks bring
in, e.g. the need to occasionally rebase commits between bookmarks,
practically make hg as complex as using git is. i don't like git, but
i don't see how hg is better in this workflow either.

Ian, at this point i badly need some input on at least this to decide
whether to pursuit the hg-git way, or to just use git. (the converted
git repo contains the full hg history)

as of the changes themselves:

the C bootstrap files are moved into ./bootstrap/c/ and the build
scripts are updated accordingly. the various stage-n repos hold the
appropriate versions of eval.c and boot.l. stage-1 is the beginning
state, without any changes by me.

as of the official repo, the following files seem to be missing,
probably they are not checked in: maru-nfibs.k, test2.c, and
maru-test2.k

hth,
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“You can avoid reality, but you cannot avoid the consequences of
avoiding reality.”
— Ayn Rand (1905–1982)




the hg-git articles i've read while doing this:

https://bitbucket.org/durin42/hg-git
http://hg-git.github.io/
http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/
http://www.kevinberridge.com/2012/05/hg-bookmarks-made-me-sad.html


$ hg clone http://bitbucket.org/durin42/hg-git



$ cat ~/.hgrc
[extensions]
record=
rebase =
hggit = ~/workspace/hg-git/hggit

[git]
# note: ~ is note expanded in 'authors'
authors = /home/alendvai/.hg-author-map.txt
# this would only bridge the bookmarks to/from git that end with this suffix
#branch_bookmark_suffix=-bm



$ cat ~/.hg-author-map.txt
piumarta = Ian Piumarta <***@piumarta.com>
Ian Piumarta = Ian Piumarta <***@piumarta.com>
***@winxp = Ian Piumarta <***@piumarta.com>
***@win7 = Ian Piumarta <***@piumarta.com>



$ cat .hg/hgrc
[paths]
default = http://piumarta.com/hg/maru/
github = git+ssh://***@github.com/attila-lendvai/maru-hg-git-experiment.git



#hg #rebasing between bookmarks, a commit from stage-2 to stage-1:

$ hg merge --preview stage-2
changeset: 620:9edd2855f621
summary: Move files needed for the C bootstrap into ./bootstrap/c

changeset: 621:---=>3c0a9370e3b6<=---
summary: Added a .hgignore


$ hg rebase --keep --rev 3c0a9370e3b6 --dest stage-1

# then we need to reset stage-2 for some reason. probably because it
# was the tip commit of stage-2 and rebasing moved the bookmark also.

$ hg bookmark -f --rev 3c0a9370e3b6 stage-2

# "pulling" this change to stage-3 requires no rebase, just moving the
# bookmark:

$ hg bookmark -f --rev 3c0a9370e3b6 stage-3
Loading...