#18618: sandpile revisions
-------------------------------------+-------------------------------------
Reporter: dperkinson | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.8
Component: graph theory | Resolution:
Keywords: sandpile | Merged in:
Authors: David Perkinson | Reviewers: Qiaoyu Yang, Kaui Yu
Report Upstream: N/A | Work issues:
Branch: | Commit:
public/sandpile_updates | 249b64720653fdd434e76336b442c1bbd5b6fe2c
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by dimpase):
* commit: 1852ccc5e3e28aadf4b1766e9d40577d74286780 =>
249b64720653fdd434e76336b442c1bbd5b6fe2c
* branch: u/dperkinson/sandpile_revisions => public/sandpile_updates
Comment:
As it is longer to explain how to proceed than to do it myself, I record
steps I undertake;
please feel free to ask for explanation.
Start by cloning a clean Sage 6.8.beta8 (described in the manual). Go to
its root, and do
{{{
$ git fetch trac u/dperkinson/sandpile_revisions
From trac.sagemath.org:sage
* branch u/dperkinson/sandpile_revisions -> FETCH_HEAD
clpc171[/home/scratch/dimpase/sage/tmp]$ git merge FETCH_HEAD
Auto-merging src/sage/sandpiles/sandpile.py
CONFLICT (content): Merge conflict in src/sage/sandpiles/sandpile.py
Automatic merge failed; fix conflicts and then commit the result.
clpc171[/home/scratch/dimpase/sage/tmp]$ git status
On branch newsp
You have unmerged paths.
(fix conflicts and run "git commit")
Changes to be committed:
modified: src/doc/en/thematic_tutorials/sandpile.rst
modified: src/sage/sandpiles/all.py
new file: src/sage/sandpiles/examples.py
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: src/sage/sandpiles/sandpile.py
}}}
ok, so we need to sort out the conflict (cf. e.g.
https://help.github.com/articles/resolving-a-merge-conflict-from-the-
command-line/)
serach for `HEAD` in the output of the following:
{{{
$ git blame src/sage/sandpiles/sandpile.py
...
00000000 (Not Committed Yet 2015-07-13 15:28:41 +0100 598) <<<<<<<
HEAD
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 599)
processed_g = {}
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 600)
for k in g.keys():
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 601)
temp = {}
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 602)
for vertex in g[k]:
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 603)
temp[vertex] = 1
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 604)
processed_g[k] = temp
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 605)
g = processed_g
617b158e (Wilfried Luebbe 2014-03-28 16:56:44 +0100 606)
elif isinstance(g, Graph):
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 607)
processed_g = {}
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 608)
for v in g.vertices():
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 609)
edges = {}
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 610)
for n in g.neighbors(v):
e82c8f99 (Jeroen Demeyer 2015-06-29 11:01:23 +0200 611)
if (isinstance(g.edge_label(v,n), int)
e82c8f99 (Jeroen Demeyer 2015-06-29 11:01:23 +0200 612)
and g.edge_label(v,n) >= 0):
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 613)
edges[n] = g.edge_label(v,n)
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 614)
else:
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 615)
edges[n] = 1
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 616)
processed_g[v] = edges
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 617)
g = processed_g
617b158e (Wilfried Luebbe 2014-03-28 16:56:44 +0100 618)
elif isinstance(g, DiGraph):
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 619)
processed_g = {}
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 620)
for v in g.vertices():
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 621)
edges = {}
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 622)
for n in g.neighbors_out(v):
e82c8f99 (Jeroen Demeyer 2015-06-29 11:01:23 +0200 623)
if (isinstance(g.edge_label(v,n), int)
e82c8f99 (Jeroen Demeyer 2015-06-29 11:01:23 +0200 624)
and g.edge_label(v,n) >= 0):
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 625)
edges[n] = g.edge_label(v,n)
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 626)
else:
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 627)
edges[n] = 1
07981740 (Marshall Hampton 2011-01-12 00:17:35 -0600 628)
processed_g[v] = edges
00000000 (Not Committed Yet 2015-07-13 15:28:41 +0100 629) =======
9e022d84 (David Perkinson 2015-06-11 07:10:23 -0700 630)
processed_g = {i:dict(Counter(g[i])) for i in g}
00000000 (Not Committed Yet 2015-07-13 15:28:41 +0100 631) >>>>>>>
FETCH_HEAD
...
}}}
here (look at its date!) is the commit that prevents a clean merge:
{{{
commit e82c8f99d6493f48d3a02c598fc723e693f5616f
Author: Jeroen Demeyer <[email protected]>
Date: Mon Jun 29 11:01:23 2015 +0200
Fix suspicious isinstance() changes
}}}
as it changes stuff in a place that has to be removed, we can basically
ignore it.
(that is, when rebasing, the corresponding chunk can just be removed).
Now open `src/sage/sandpiles/sandpile.py` in an editor and remove the
lines between `<<<..< HEAD` and `====`,
as well as the lines with `<<<..< HEAD`, `====`, and `>>>>>>> FETCH_HEAD`.
Now we can commit our changes.
{{{
$ git add src/sage/sandpiles/sandpile.py
$ git commit -m "rebased over that
e82c8f99d6493f48d3a02c598fc723e693f5616f"
}}}
Now locally everything is OK, run tests, etc...
Finally, I push it to trac (not using `git trac`, but rather "git the hard
way" :-))
{{{
$ git push trac --set-upstream HEAD:public/sandpile_updates
}}}
and in the browser replace your (broken, shown in red) Branch:
`u/dperkinson/sandpile_revisions` with `public/sandpile_updates`. And
click Submit. (your branch is still there on the server, by the way).
----
New commits:
||[http://git.sagemath.org/sage.git/commit/?id=249b64720653fdd434e76336b442c1bbd5b6fe2c
249b647]||{{{rebased over that
e82c8f99d6493f48d3a02c598fc723e693f5616f}}}||
--
Ticket URL: <http://trac.sagemath.org/ticket/18618#comment:48>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.