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

how to show diff ? #4

Open
urwork opened this issue May 12, 2019 · 15 comments
Open

how to show diff ? #4

urwork opened this issue May 12, 2019 · 15 comments
Labels

Comments

@urwork
Copy link

urwork commented May 12, 2019

how to show diff ?

@scottfurry
Copy link

Probably not the answer you were looking for, but from the README:

diff changes (in a future release)

I don't use go, so I'm unsure if this is the definitive answer.

@justinclift
Copy link
Member

justinclift commented May 13, 2019

@urwork Yeah, we don't yet have the feature. 😦

It should be possible to show the different rows without a huge amount of development time, so expect that in (maybe) a month or so. eg not in the next few weeks

Development time is current being put into some foundation pieces for the online website instead, to enable visual diffs being done there. That bit is a lot of work, currently being done. 😉

@justinclift
Copy link
Member

As a thought, for a very manual workaround (for now), it should be possible to use the SQLite sqldiff command line tool: https://www.sqlite.org/sqldiff.html

When we implement the diff capability in dio, it'll likely be done (at least initially) by copying the approach there. 😄

@remram44
Copy link

I'm also wondering what kind of merges can dbhub handle? How are conflicts handled?

I was trying it for myself but ran into #6

@justinclift
Copy link
Member

At the moment, all commits are just stored as a brand new database. No optimisation whatsoever. 😉

That means - at present - there isn't a concept of conflicts, as each database is accepted verbatim (and stored as given).

The list of changes in Merge Requests (thus far) is very simple, just showing the commits that have occurred between the source and destination repo branches. It doesn't introspect the data at all to compare or diff between them.

That will improve over time, it's just turning out to be quite a lot of work needed to do this well:

  • Detect the difference(s)
  • Display them in meaning ways

For trivial differences - eg: just a few rows - neither of those is hard. For non-trivial things though, both can be very complicated. I'm still upgrading my skills for the display part, and haven't begun coding an initial prototype solution yet. 😦

@remram44
Copy link

How do branches and merge requests work, though? Do you only accept a merge if there are absolutely no concurrent changes?

@justinclift
Copy link
Member

It's all done on the commit level. If the merge request has a common point in shared commit history with the branch it's being merged to, it'll be allowed.

Things without a common/shared commit history make no sense, so Merge Requests aren't allowed on them.

It tries to follow the git model, and (thus far) seems pretty close.

@remram44
Copy link

But you say it can't resolve conflicts...

What happens in this case:

A---B---C (branch master)
     \
      D (branch fix)

If I send a merge request to merge fix into master, while there has been a new concurrent commit in master (C). There is a shared commit in history (B), however you say that there is no way to resolve conflicts. If this merge request is accepted, what happens?

A---B---C---M
     \     /
      D----

M is the same as D (losing commit C)? Or is this not allowed?

@justinclift
Copy link
Member

Well, after that merge the commit history should be A, B, C, M.

Hmmm, maybe create a 2nd account for yourself and try it out? 😄

Can create a test account for you if that'd be useful.

@remram44
Copy link

Unfortunately I ran into #6 and couldn't test further.

What is the result though? Are the changes from D lost? Are the changes from C lost?

@justinclift
Copy link
Member

None of the changes are lost. Like with git, it will pick the changes in the MR up and append them to the end of the target branch. 😄

I'll fix #6 over the next few days too. Sorry about that. 😦

@remram44
Copy link

But how do you "append changes" to databases, if it has been modified in the target branch? You need a way to reconcile concurrent changes, and I'm asking if you have this or not.

@justinclift
Copy link
Member

Ahhhh, now I get what you're asking.

At the moment, each commit is just the associated database for that commit. So, in the scenario above it'll just be the (complete) database from 'M'. The previous commits are still in the history, but there's no merging of data (etc) between the commits.

@justinclift
Copy link
Member

As a data point, the online visualisation capability we've been working on was recently made available. eg: example here

That's a pre-requisite for being able to generate and show diffs (and figure out how best to merge them), so we should be able to start working on that in the near future.

Hopefully it takes less than the ~year or so to get working, that the visualisation pieces did. 😉 There was lots of exploration-avenues-that-turned-out-to-be-useless for the visualisation stuff. 😦

@MKleusberg
Copy link
Member

But you say it can't resolve conflicts...

What happens in this case:

A---B---C (branch master)
     \
      D (branch fix)

If I send a merge request to merge fix into master, while there has been a new concurrent commit in master (C). There is a shared commit in history (B), however you say that there is no way to resolve conflicts. If this merge request is accepted, what happens?

A---B---C---M
     \     /
      D----

M is the same as D (losing commit C)? Or is this not allowed?

@remram44 We finally added support for merging in situations like you describe them. I you are still around I'd be very interested in your test results. On the website there are several "View Changes" buttons now which produce a diff. And it's possible to merge two branches now via a merge request.

For now we check if the same row of a table has been edited in both branches and if so abort with an error message. This is a bit too strict because we don't yet check if the changes are actually compatible. But as long as you don't have conflicts like this the MR is closed and the changes of C and D are part of M.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants