-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Adds side-by-side diff for images #6784
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
5a4401f
Adds side-by-side diff for images
saitho b034635
Explain blank imports
saitho 0989146
Use complete word for width and height labels on image compare
saitho 72913a6
Merge remote-tracking branch 'origin/master' into feature/6255-Image_…
saitho 1b1915e
Update index.css from master
saitho 8c74e23
Moves ImageInfo to git commit file
saitho 14791f8
Assign ImageInfo function for template and sets correct target for Be…
saitho 1087cb0
Adds missing comment
saitho a17d536
Merge branch 'master' into feature/6255-Image_diff
jonasfranz d8d6249
Merge branch 'master' into feature/6255-Image_diff
saitho 7565651
Return error if ImageInfo failed
saitho 5cbcd9d
Avoid template panic when ImageInfo failed for some reason
saitho 903b6e0
Show file size on image diff
saitho 5b7af2f
Removes unused helper function
saitho e4aaf9c
Reverts copyright year change
saitho 67ff159
Close file reader
saitho 8f2cedf
Update commit.go
saitho f03d38d
Moves reader.Close() up a few lines
saitho 33f636e
Merge remote-tracking branch 'origin/master' into feature/6255-Image_…
saitho 210d036
Updates index.css
saitho f963740
Updates CSS file
saitho 172bd4d
Merge branch 'master' into feature/6255-Image_diff
saitho d9910df
Merge remote-tracking branch 'upstream/master' into feature/6255-Imag…
saitho af9dcc5
Transfers adjustments for image compare to compare.go file
saitho 99ac70e
Adjusts variable name
saitho 2f9bfc7
Apply lesshint recommendations
saitho 6834221
Merge branch 'master' into feature/6255-Image_diff
lunny 72849e2
Merge branch 'master' into feature/6255-Image_diff
lunny 3af68e8
Merge branch 'master' into feature/6255-Image_diff
lunny 2507754
Merge branch 'master' into feature/6255-Image_diff
techknowlogick 83c14fc
Merge branch 'master' into feature/6255-Image_diff
saitho 561f080
Do not show old image on image compare if it is not in index of base …
saitho 4f97c18
Change file size text
saitho d9e8a4b
Merge branch 'master' into feature/6255-Image_diff
lunny de85e46
Merge branch 'master' into feature/6255-Image_diff
lunny 498b8d2
Merge branch 'master' into feature/6255-Image_diff
lafriks 46bee76
Merge branch 'master' into feature/6255-Image_diff
lunny 6d0453b
Merge branch 'master' into feature/6255-Image_diff
lafriks 8cbbc7e
Merge branch 'master' into feature/6255-Image_diff
lunny 978ea10
Merge branch 'master' into feature/6255-Image_diff
lunny e4e99a5
Merge branch 'master' into feature/6255-Image_diff
lunny 69083b1
Merge branch 'master' into feature/6255-Image_diff
lafriks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1364,6 +1364,10 @@ | |
width: 49%; | ||
} | ||
|
||
td.center { | ||
text-align: center; | ||
} | ||
|
||
.removed-code { | ||
background-color: #ff9999; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,23 @@ func Diff(ctx *context.Context) { | |
ctx.Data["Username"] = userName | ||
ctx.Data["Reponame"] = repoName | ||
ctx.Data["IsImageFile"] = commit.IsImageFile | ||
ctx.Data["ImageInfo"] = func(name string) *git.ImageMetaData { | ||
result, err := commit.ImageInfo(name) | ||
if err != nil { | ||
log.Error("ImageInfo failed: %v", err) | ||
return nil | ||
} | ||
return result | ||
} | ||
ctx.Data["ImageInfoBase"] = ctx.Data["ImageInfo"] | ||
if commit.ParentCount() > 0 { | ||
parentCommit, err := ctx.Repo.GitRepo.GetCommit(parents[0]) | ||
if err != nil { | ||
ctx.NotFound("GetParentCommit", err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
return | ||
} | ||
ctx.Data["ImageInfo"] = parentCommit.ImageInfo | ||
} | ||
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitID) | ||
ctx.Data["Commit"] = commit | ||
ctx.Data["Verification"] = models.ParseCommitWithSignature(commit) | ||
|
@@ -248,6 +265,7 @@ func Diff(ctx *context.Context) { | |
ctx.Data["Parents"] = parents | ||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 | ||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", commitID) | ||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", commitID) | ||
|
||
note := &git.Note{} | ||
err = git.GetNote(ctx.Repo.GitRepo, commitID, note) | ||
|
@@ -259,8 +277,8 @@ func Diff(ctx *context.Context) { | |
|
||
if commit.ParentCount() > 0 { | ||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", parents[0]) | ||
ctx.Data["BeforeRawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", parents[0]) | ||
} | ||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "raw", "commit", commitID) | ||
ctx.Data["BranchName"], err = commit.GetBranchName() | ||
if err != nil { | ||
ctx.ServerError("commit.GetBranchName", err) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -535,16 +535,41 @@ func ViewPullFiles(ctx *context.Context) { | |
ctx.Data["Diff"] = diff | ||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 | ||
|
||
baseCommit, err := ctx.Repo.GitRepo.GetCommit(startCommitID) | ||
if err != nil { | ||
ctx.ServerError("GetCommit", err) | ||
return | ||
} | ||
commit, err := gitRepo.GetCommit(endCommitID) | ||
if err != nil { | ||
ctx.ServerError("GetCommit", err) | ||
return | ||
} | ||
|
||
ctx.Data["IsImageFile"] = commit.IsImageFile | ||
ctx.Data["ImageInfoBase"] = func(name string) *git.ImageMetaData { | ||
result, err := baseCommit.ImageInfo(name) | ||
if err != nil { | ||
log.Error("ImageInfo failed: %v", err) | ||
return nil | ||
} | ||
return result | ||
} | ||
ctx.Data["ImageInfo"] = func(name string) *git.ImageMetaData { | ||
result, err := commit.ImageInfo(name) | ||
if err != nil { | ||
log.Error("ImageInfo failed: %v", err) | ||
return nil | ||
} | ||
return result | ||
} | ||
|
||
baseTarget := path.Join(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) | ||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", endCommitID) | ||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(headTarget, "src", "commit", startCommitID) | ||
ctx.Data["RawPath"] = setting.AppSubURL + "/" + path.Join(headTarget, "raw", "commit", endCommitID) | ||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(baseTarget, "src", "commit", startCommitID) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that I changed "headTarget" to "baseTarget", as the "before" paths should point to the forked repository. |
||
ctx.Data["BeforeRawPath"] = setting.AppSubURL + "/" + path.Join(baseTarget, "raw", "commit", startCommitID) | ||
saitho marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ctx.Data["RequireHighlightJS"] = true | ||
ctx.Data["RequireTribute"] = true | ||
if ctx.Data["Assignees"], err = ctx.Repo.Repository.GetAssignees(); err != nil { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.