Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore gen-*.py script history #13

Closed
wking opened this issue Nov 8, 2014 · 1 comment
Closed

Restore gen-*.py script history #13

wking opened this issue Nov 8, 2014 · 1 comment

Comments

@wking
Copy link
Contributor

wking commented Nov 8, 2014

These were dropped by one of the earlier filter-branch clones (see #4). Just to be clear about which repositories I'm referring to, here are my remote names for this section:

$ git remote -v
bc      ssh://git@github.com/swcarpentry/bc.git (fetch)
bc      ssh://git@github.com/swcarpentry/bc.git (push)
modular-shell   git://github.com:wking/swc-modular-shell.git (fetch)
modular-shell   ssh://git@github.com/wking/swc-modular-shell.git (push)

What's the history for gen-sequence.py in bc?

$ git log --follow --oneline bc/master -- novice/shell/gen-sequence.py
b8c7dc3 Reorganizing material to put novice + intermediate at top level
3a38907 shell: Rename the new-style lessons from 'bash' to 'shell'
f4cc356 Updating index file and moving utility scripts to the right place
a41a27d Renaming directories with example files
03b26ac Example files for intro to shell

Which of those commits are in modular-shell?

$ git log --oneline modular-shell/master | grep 'Reorganizing material\|shell: Rename the new-style\|Updating index file and moving\|Renaming directories with\|Example files for'
c6ac923 Updating index file and moving utility scripts to the right place
09fb561 Renaming directories with example files
c08de6f Example files for intro to shell

Taking a closer look at our breaking commit:

$ git show --oneline --stat c6ac923
c6ac923 Updating index file and moving utility scripts to the right place
 creatures/gen-sequence.py | 10 ----------
 index.md                  | 24 ++++++++++++++++--------
 2 files changed, 16 insertions(+), 18 deletions(-)

And the bc commit it's based on:

$ git show --oneline --stat --find-copies f4cc356
f4cc356 Updating index file and moving utility scripts to the right place
 bash/novice/index.md                            | 24 ++++++++++++++++--------
 bash/util/gen-nene.py                           |  2 ++
 bash/{novice/creatures => util}/gen-sequence.py |  2 ++
 3 files changed, 20 insertions(+), 8 deletions(-)

Hmm, so this commit is bumping gen-nene.py, and we'll have to look at that too. What's its history in bc?

$ git log --follow --oneline bc/master -- novice/shell/gen-nene.py
b8c7dc3 Reorganizing material to put novice + intermediate at top level
3a38907 shell: Rename the new-style lessons from 'bash' to 'shell'
f4cc356 Updating index file and moving utility scripts to the right place
090b60b Put randomly generated data in files

Do we have that first commit in modular-shell?

$ git log --oneline modular-shell/master | grep 'Put randomly generated'

What's it touching there?

$ git show --stat 66cf53e
commit 66cf53e794d8cbbb6be291131045b105d751d39e
Author: Damien Irving <damien_irving@yahoo.com.au>
Date:   Fri Nov 29 07:44:39 2013 +1100

    Put randomly generated data in files

 .../north-pacific-gyre/2012-07-03/NENE01729A.txt   | 600 ++++++++++-----------
 .../north-pacific-gyre/2012-07-03/NENE01729B.txt   | 600 ++++++++++-----------
…
 .../north-pacific-gyre/2012-07-03/NENE02043B.txt   | 600 ++++++++++-----------
 05-scripting/backup/chloratin.dat                  | 178 +++---
 05-scripting/backup/sphag-merged.dat               | 344 ++++++------
 05-scripting/chloratin.dat                         |  58 +-
 05-scripting/girmanis.dat                          | 364 ++++++-------
 05-scripting/sphag2.dat                            | 312 +++++------
 05-scripting/sphagnoi.dat                          | 182 +++----
 23 files changed, 5759 insertions(+), 5759 deletions(-)

So our filter-branched commit doesn't add gen-nene.py, because swcarpentry/DEPRECATED-bc@090b60b had added it to a different directory (bash/util/gen-nene.py). I don't think we want auto-generated content in the repository anyway, so I might try and refactor this bit of history entirely…

@wking
Copy link
Contributor Author

wking commented Dec 3, 2014

The initial filter-branch was overly aggressive, dropping bash/util. I've restored the gen-sequence.py and gen-nene.py by replacing the overly-filtered c6ac923 with a cherry-picked-and-tweaked version of swcarpentry/DEPRECATED-bc@f4cc356. Here's the broken filter branch history in the area:

$ git log --graph --topo-order --oneline --decorate | grep -3 'Updating index file and'
* | | 6dc2c67 Adding shell cheat sheet
| |/
|/|
* | c6ac923 Updating index file and moving utility scripts to the right place
* | 1b4e8cb Instructor's guide for Python
* | 82b2250 Incorporating Raniere's fixes
* |   e2a3a8e Merge branch 'master' into fixing-spaces-in-filenames-example

Drop c6ac923 and fill in from swcarpentry/DEPRECATED-bc@f4cc356:

$ git checkout -b wip c6ac923^
$ git cherry-pick f4cc356
$ git rm bash/novice/creatures/gen-sequence.py creatures/gen-sequence.py
$ git add bash/util/gen-nene.py bash/util/gen-sequence.py
$ git mv bash/util/*.py ./
$ git cherry-pick --continue

Where the removes drop the copies from the rebased history, and add and mv put the new copies from swcarpentry/DEPRECATED-bc@f4cc356 in the right place. Check that the new commit does the right stuff:

$ git show --stat -M50
commit a227a32a8a63988ec4e72bb9987982f4d69f8dae
Author: Greg Wilson <gvwilson@third-bit.com>
Date:   Fri Nov 29 15:11:24 2013 -0500

    Updating index file and moving utility scripts to the right place

 gen-nene.py                                  | 27 +++++++++++++++++++++++++++
 creatures/gen-sequence.py => gen-sequence.py |  2 ++
 index.md                                     | 24 ++++++++++++++++--------
 3 files changed, 45 insertions(+), 8 deletions(-)

Shift the rest of our earlier extraction from the broken c6ac923 to the new wip branch:

$ git checkout novice-shell
$ git rebase -p --onto wip c6ac923

Check that the history looks the same:

$ git log --graph --topo-order --oneline --decorate | grep -3 'Updating index file and'
* | | ccac789 Adding shell cheat sheet
| |/
|/|
* | a227a32 (wip) Updating index file and moving utility scripts to the right place
* | 1b4e8cb Instructor's guide for Python
* | 82b2250 Incorporating Raniere's fixes
* |   e2a3a8e Merge branch 'master' into fixing-spaces-in-filenames-example

Check that the content matches bc (with HEAD^ because we've landed #1 locally, and that content isn't in bc):

$ diff -u <(git ls-tree -r bc/master -- novice/shell | sed 's|novice/shell/||') <(git ls-tree -r HEAD^)
… no difference …

Horray :).

@wking wking closed this as completed Dec 3, 2014
rgaiacs pushed a commit to rgaiacs/swc-shell-novice that referenced this issue May 6, 2017
fmichonneau pushed a commit to fmichonneau/shell-novice that referenced this issue Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant