Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14082595
D11994.id28880.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D11994.id28880.diff
View Options
diff --git a/src/applications/differential/__tests__/data/generated.diff.one.unshielded b/src/applications/differential/__tests__/data/generated.diff.one.unshielded
--- a/src/applications/differential/__tests__/data/generated.diff.one.unshielded
+++ b/src/applications/differential/__tests__/data/generated.diff.one.unshielded
@@ -1,6 +1,6 @@
N 1 . @generated\n~
O 2 - \n~
-N 2 + \n~
O 3 - This is a generated file.\n~
+N 2 + \n~
N 3 + This is a generated file{(, full of generated code)}.\n~
N 4 . \n~
diff --git a/src/applications/differential/__tests__/data/groups.diff b/src/applications/differential/__tests__/data/groups.diff
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/__tests__/data/groups.diff
@@ -0,0 +1,16 @@
+diff --git a/style b/style
+index a5fc249..f683713 100644
+--- a/style
++++ b/style
+@@ -57,9 +57,9 @@
+ .dashboard-panel div.phabricator-feed-frame {
+ background: #fff;
+ margin: 0;
+- border-left: 1px solid {$lightblueborder};
+- border-right: 1px solid {$lightblueborder};
+- border-bottom: 1px solid {$blueborder};
++ border-back: 1px solid {$lightblueborder};
++ border-front: 1px solid {$lightblueborder};
++ border-inside: 1px solid {$blueborder};
+ max-width: none;
+ }
diff --git a/src/applications/differential/__tests__/data/groups.diff.one.expect b/src/applications/differential/__tests__/data/groups.diff.one.expect
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/__tests__/data/groups.diff.one.expect
@@ -0,0 +1,18 @@
+CTYPE 2 1 (unforced)
+style
+style
+-
+X <MISSING-CONTEXT>
+N 57 . .dashboard-panel div.phabricator-feed-frame {\n~
+N 58 . background: #fff;\n~
+N 59 . margin: 0;\n~
+O 60 - border-{(left)}: 1px solid {$lightblueborder};\n~
+O 61 - border-{(righ)}t: 1px solid {$lightblueborder};\n~
+O 62 - border-{(bottom)}: 1px solid {$blueborder};\n~
+N 60 + border-{(back)}: 1px solid {$lightblueborder};\n~
+N 61 + border-{(fron)}t: 1px solid {$lightblueborder};\n~
+N 62 + border-{(inside)}: 1px solid {$blueborder};\n~
+N 63 . max-width: none;\n~
+N 64 . }\n~
+N 65 . \n~
+X <MISSING-CONTEXT>
diff --git a/src/applications/differential/__tests__/data/groups.diff.two.expect b/src/applications/differential/__tests__/data/groups.diff.two.expect
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/__tests__/data/groups.diff.two.expect
@@ -0,0 +1,24 @@
+CTYPE 2 1 (unforced)
+style
+style
+-
+X <MISSING-CONTEXT>
+O 57 . .dashboard-panel div.phabricator-feed-frame {\n~
+N 57 . .dashboard-panel div.phabricator-feed-frame {\n~
+O 58 . background: #fff;\n~
+N 58 . background: #fff;\n~
+O 59 . margin: 0;\n~
+N 59 . margin: 0;\n~
+O 60 - border-{(left)}: 1px solid {$lightblueborder};\n~
+N 60 + border-{(back)}: 1px solid {$lightblueborder};\n~
+O 61 - border-{(righ)}t: 1px solid {$lightblueborder};\n~
+N 61 + border-{(fron)}t: 1px solid {$lightblueborder};\n~
+O 62 - border-{(bottom)}: 1px solid {$blueborder};\n~
+N 62 + border-{(inside)}: 1px solid {$blueborder};\n~
+O 63 . max-width: none;\n~
+N 63 . max-width: none;\n~
+O 64 . }\n~
+N 64 . }\n~
+O 65 . \n~
+N 65 . \n~
+X <MISSING-CONTEXT>
diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php
--- a/src/applications/differential/render/DifferentialChangesetRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetRenderer.php
@@ -503,10 +503,6 @@
// Ignore it when rendering a one-up diff.
continue;
}
- if ($new_buf) {
- $out[] = $new_buf;
- $new_buf = array();
- }
$old_buf[] = $primitive;
} else if ($type == 'new') {
if ($primitive['line'] === null) {
@@ -514,17 +510,16 @@
// old file. Ignore it when rendering a one-up diff.
continue;
}
- if ($old_buf) {
- $out[] = $old_buf;
- $old_buf = array();
- }
if (!$primitive['htype']) {
// If this line is the same in both versions of the file, put it in
// the old line buffer. This makes sure inlines on old, unchanged
// lines end up in the right place.
- // First, we need to flush the new line buffer if there's anything
- // in it.
+ // First, we need to flush the line buffers if they're not empty.
+ if ($old_buf) {
+ $out[] = $old_buf;
+ $old_buf = array();
+ }
if ($new_buf) {
$out[] = $new_buf;
$new_buf = array();
@@ -545,15 +540,15 @@
if (!$primitive['right']) {
$out[] = $old_buf;
$out[] = array($primitive);
- $out[] = $new_buf;
+ $old_buf = array();
} else {
$out[] = $old_buf;
$out[] = $new_buf;
$out[] = array($primitive);
+ $old_buf = array();
+ $new_buf = array();
}
- $old_buf = array();
- $new_buf = array();
} else {
throw new Exception("Unknown primitive type '{$primitive}'!");
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 12:29 AM (19 h, 2 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6780358
Default Alt Text
D11994.id28880.diff (5 KB)
Attached To
Mode
D11994: Further improve line grouping in unified views
Attached
Detach File
Event Timeline
Log In to Comment