Commit graph

28 commits

Author SHA1 Message Date
Alejandro Rodríguez
3fcab51ebb Refactor conflict resolution to contain git ops within Gitlab::Git
This prepares the codebase for a Gitaly migration. See
https://gitlab.com/gitlab-org/gitaly/issues/553
2017-10-12 22:03:14 -03:00
Alejandro Rodríguez
f72598b659 Move Gitlab::Diff::LineCode to module Gitlab::Git 2017-10-12 21:45:16 -03:00
Douwe Maan
c81928cfa7 Include new URL helpers retroactively into includers of Gitlab::Routing 2017-07-07 10:43:37 -05:00
Douwe Maan
fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Sean McGivern
811e598f60 Enable and autocorrect the CustomErrorClass cop 2017-03-01 15:28:10 +00:00
Douwe Maan
5c7f9d69e3 Fix code for cops 2017-02-23 09:31:57 -06:00
Douwe Maan
8a4d68c53e Enable Style/ConditionalAssignment 2017-02-23 09:31:57 -06:00
Sean McGivern
3764fd4b41 Add blob_ace_mode to conflict content response 2016-10-13 14:16:35 -05:00
Sean McGivern
4743d19463 Simplify conflict file JSON creation 2016-10-13 14:16:34 -05:00
Sean McGivern
3f71c43e88 Allow setting content for resolutions
When reading conflicts:

1. Add a `type` field. `text` works as before, and has `sections`;
   `text-editor` is a file with ambiguous conflict markers that can only
   be resolved in an editor.
2. Add a `content_path` field pointing to a JSON representation of the
   file's content for a single file.
3. Hitting `content_path` returns a similar datastructure to the `file`,
   but without the `content_path` and `sections` fields, and with a
   `content` field containing the full contents of the file (with
   conflict markers).

When writing conflicts:

1. Instead of `sections` being at the top level, they are now in a
   `files` array. This matches the read format better.
2. The `files` array contains file hashes, each of which must contain:
   a. `new_path`
   b. `old_path`
   c. EITHER `sections` (which works as before) or `content` (with the
      full content of the resolved file).
2016-10-13 14:16:34 -05:00
Sean McGivern
4a3d1a5838 Handle case where conflicts aren't on disk yet 2016-08-25 12:34:54 +01:00
Douwe Maan
254dbad8f7 Fix bug where conflict view would have one too many context sections 2016-08-12 23:24:51 +03:00
Sean McGivern
4952a24f58 Find match line headers by backtracking
This is more efficient for large files than performing a regex match on
every single line.
2016-08-12 23:24:48 +03:00
Sean McGivern
ba327e69ec Move resolving code to ResolveService 2016-08-12 23:24:48 +03:00
Sean McGivern
ac9229a31b Clarify Conflict::File#sections method 2016-08-12 23:24:48 +03:00
Sean McGivern
427e724698 Don't allow resolving invalid conflicts
An MR can only be resolved in the UI if:
- It has conflicts.
- It has valid diff_refs (in other words, it supports new diff notes).
- It has no conflicts with one side missing.
- It has no conflicts in binary files.
- It has no conflicts in files too large to display.
- It has no conflicts containing invalid conflict markers.
2016-08-12 23:24:48 +03:00
Sean McGivern
52eb523c9b Add blob_icon to conflict file JSON 2016-08-12 23:24:47 +03:00
Sean McGivern
e50e88b85c Add blob_path to conflict file JSON 2016-08-12 23:24:47 +03:00
Sean McGivern
3b84cfdc74 Use same resolution format on FE and BE 2016-08-12 23:24:46 +03:00
Sean McGivern
261d47bce9 Fix specs
- Add match line header to expected result for `File#sections`.
- Lowercase CSS colours.
- Remove unused `diff_refs` keyword argument.
- Rename `parent` -> `parent_file`, to be more explicit.
- Skip an iteration when highlighting.
2016-08-12 23:24:46 +03:00
Sean McGivern
6f3501fe25 Fix match line headers at start / end of file 2016-08-12 23:24:46 +03:00
Sean McGivern
10cf933f70 Highlight files based on merged file 2016-08-12 23:24:45 +03:00
Sean McGivern
f0bbfe7a62 Add match line headers 2016-08-12 23:24:44 +03:00
Sean McGivern
f2f844693e Handle conflict resolution errors in controller 2016-08-12 23:24:44 +03:00
Sean McGivern
7af277f683 Auto-highlight conflict when rich_text is called 2016-08-12 23:24:43 +03:00
Sean McGivern
14a4b17d1c Allow resolving conflicts in MR controller 2016-08-12 23:24:43 +03:00
Sean McGivern
a1c7961217 Handle multiple merge conflict files in collection 2016-08-12 23:24:43 +03:00
Sean McGivern
df2ed097b7 Add backend for merge conflicts reading 2016-08-12 23:24:43 +03:00