nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: phoenixframework/phoenix
Pull request #3111 (2018-10-20 18:31:48)

The mix task for phx.gen.cert should also propose `cipher_suite: :str…
…ing` like the comments in dev.exs


Patch:
diff --git a/lib/mix/tasks/phx.gen.cert.ex b/lib/mix/tasks/phx.gen.cert.ex
index a42e0f0a5..34297e1d7 100644
--- a/lib/mix/tasks/phx.gen.cert.ex
+++ b/lib/mix/tasks/phx.gen.cert.ex
@@ -126,6 +126,7 @@ defmodule Mix.Tasks.Phx.Gen.Cert do
         http: [port: 4000],
         https: [
           port: 4001,
+          cipher_suite: :strong,
           certfile: "#{certfile}",
           keyfile: "#{keyfile}"
         ],


Test patch:
diff --git a/installer/templates/phx_single/config/test.exs b/installer/templates/phx_single/config/test.exs
index cc1772f4f..55dd6f329 100644
--- a/installer/templates/phx_single/config/test.exs
+++ b/installer/templates/phx_single/config/test.exs
@@ -3,7 +3,7 @@ use Mix.Config
 # We don't run a server during test. If one is required,
 # you can enable the server option below.
 config :<%= app_name %>, <%= endpoint_module %>,
-  http: [port: 4001],
+  http: [port: 4002],
   server: false
 
 # Print only warnings and errors during test
diff --git a/installer/templates/phx_umbrella/apps/app_name_web/config/test.exs b/installer/templates/phx_umbrella/apps/app_name_web/config/test.exs
index 57e814f1c..40f0ce1d9 100644
--- a/installer/templates/phx_umbrella/apps/app_name_web/config/test.exs
+++ b/installer/templates/phx_umbrella/apps/app_name_web/config/test.exs
@@ -7,5 +7,5 @@ use Mix.Config
 # We don't run a server during test. If one is required,
 # you can enable the server option below.
 config :<%= web_app_name %>, <%= endpoint_module %>,
-  http: [port: 4001],
+  http: [port: 4002],
   server: false
Repository: phoenixframework/phoenix
Pull request #3196 (2018-12-04 10:53:05)

Removes extra line break on phx.gen.schema template
Removes extra line break that makes the formatter update newly generated schema file


Patch:
diff --git a/priv/templates/phx.gen.schema/schema.ex b/priv/templates/phx.gen.schema/schema.ex
index fa1a6e705..6ef1af53d 100644
--- a/priv/templates/phx.gen.schema/schema.ex
+++ b/priv/templates/phx.gen.schema/schema.ex
@@ -1,7 +1,6 @@
 defmodule <%= inspect schema.module %> do
   use Ecto.Schema
   import Ecto.Changeset
-
 <%= if schema.binary_id do %>
   @primary_key {:id, :binary_id, autogenerate: true}
   @foreign_key_type :binary_id<% end %>


Test patch:
diff --git a/test/mix/tasks/phx.gen.schema_test.exs b/test/mix/tasks/phx.gen.schema_test.exs
index d6f769e8f..b701702d1 100644
--- a/test/mix/tasks/phx.gen.schema_test.exs
+++ b/test/mix/tasks/phx.gen.schema_test.exs
@@ -270,6 +270,16 @@ defmodule Mix.Tasks.Phx.Gen.SchemaTest do
     end
   end
 
+  test "generates schema without extra line break", config do
+    in_tmp_project config.test, fn ->
+      Gen.Schema.run(~w(Blog.Post posts title))
+
+      assert_file "lib/phoenix/blog/post.ex", fn file ->
+        assert file =~ "import Ecto.Changeset\n\n  schema"
+      end
+    end
+  end
+
   describe "inside umbrella" do
     test "raises with false context_app", config do
       in_tmp_umbrella_project config.test, fn ->
Repository: phoenixframework/phoenix
Pull request #3198 (2018-12-05 01:48:09)

Document the use of `Phoenix.Tracker` instead of `Phoenix.Presence`
This PR adds some documentation to clear up some confusion I had. My use case was around using `Phoenix.Presence` but not broadcasting diff events (handle_diff -> no op). Phoenix.Tracker is a better fit than Presence in this situation, but I was not aware of it from the docs.


Patch:
diff --git a/lib/phoenix/presence.ex b/lib/phoenix/presence.ex
index 3b041a97b..e16c2581b 100644
--- a/lib/phoenix/presence.ex
+++ b/lib/phoenix/presence.ex
@@ -5,9 +5,15 @@ defmodule Phoenix.Presence do
   This behaviour provides presence features such as fetching
   presences for a given topic, as well as handling diffs of
   join and leave events as they occur in real-time. Using this
-  module defines a supervisor and allows the calling module to
-  implement the `Phoenix.Tracker` behaviour which starts a
-  tracker process to handle presence information.
+  module defines a supervisor and a module that implements the
+  `Phoenix.Tracker` behaviour that uses `Phoenix.PubSub` to
+  broadcast presence updates.
+
+  In case you want to use only a subset of the functionality
+  provided by `Phoenix.Presence`, such as tracking processes
+  but without broadcasting updates, we recommend that you look
+  at the `Phoenix.Tracker` functionality from the `phoenix_pubsub`
+  project.
 
   ## Example Usage
 
diff --git a/priv/templates/phx.gen.schema/schema.ex b/priv/templates/phx.gen.schema/schema.ex
index fa1a6e705..6ef1af53d 100644
--- a/priv/templates/phx.gen.schema/schema.ex
+++ b/priv/templates/phx.gen.schema/schema.ex
@@ -1,7 +1,6 @@
 defmodule <%= inspect schema.module %> do
   use Ecto.Schema
   import Ecto.Changeset
-
 <%= if schema.binary_id do %>
   @primary_key {:id, :binary_id, autogenerate: true}
   @foreign_key_type :binary_id<% end %>


Test patch:
diff --git a/test/mix/tasks/phx.gen.schema_test.exs b/test/mix/tasks/phx.gen.schema_test.exs
index d6f769e8f..b701702d1 100644
--- a/test/mix/tasks/phx.gen.schema_test.exs
+++ b/test/mix/tasks/phx.gen.schema_test.exs
@@ -270,6 +270,16 @@ defmodule Mix.Tasks.Phx.Gen.SchemaTest do
     end
   end
 
+  test "generates schema without extra line break", config do
+    in_tmp_project config.test, fn ->
+      Gen.Schema.run(~w(Blog.Post posts title))
+
+      assert_file "lib/phoenix/blog/post.ex", fn file ->
+        assert file =~ "import Ecto.Changeset\n\n  schema"
+      end
+    end
+  end
+
   describe "inside umbrella" do
     test "raises with false context_app", config do
       in_tmp_umbrella_project config.test, fn ->
Repository: phoenixframework/phoenix
Pull request #2801 (2018-03-09 13:55:16)

Generate a static_push function in the RouteHelpers
The `static_push/2` function is a drop in replacement for `static_path/2` with
the addition of performing a server push if the adapter allows. This function
only supports using a `Plug.Conn` struct - attempting to use it with an endpoint
will result in an error.

Gazler: This depends on https://github.com/elixir-plug/plug/pull/678#pullrequestreview-102651352 - so we should wait for a new version of plug.

Patch:
diff --git a/lib/phoenix/router/helpers.ex b/lib/phoenix/router/helpers.ex
index abcdbc027..361034ec3 100644
--- a/lib/phoenix/router/helpers.ex
+++ b/lib/phoenix/router/helpers.ex
@@ -152,6 +152,19 @@ defmodule Phoenix.Router.Helpers do
         endpoint.static_path(path)
       end
 
+      @doc """
+      Performs a server push and returns the path to a static asset given its file path.
+
+      The server push will only happen if using HTTP/2 with a supported plug adapter.
+      If not supported, this function will simply return the path to the static
+      asset.
+      """
+      def static_push(%Conn{} = conn, path) do
+        path = static_path(conn, path)
+        Plug.Conn.push(conn, path)
+        path
+      end
+
       @doc """
       Generates url to a static asset given its file path.
       """


Test patch:
diff --git a/test/phoenix/router/helpers_test.exs b/test/phoenix/router/helpers_test.exs
index c3729d1ea..33529fcc8 100644
--- a/test/phoenix/router/helpers_test.exs
+++ b/test/phoenix/router/helpers_test.exs
@@ -415,6 +415,12 @@ defmodule Phoenix.Router.HelpersTest do
     assert Helpers.static_path(socket_with_endpoint(), "/images/foo.png") == "/images/foo.png"
   end
 
+  test "helpers module generates a static_push helper" do
+    conn = conn_with_endpoint()
+    assert Helpers.static_push(conn, "/images/foo.png") == "/images/foo.png"
+    assert {"/images/foo.png", [{"accept", "image/png"}]} in sent_pushes(conn)
+  end
+
   test "helpers module generates a static_url helper" do
     url = "https://static.example.com/images/foo.png"
     assert Helpers.static_url(__MODULE__, "/images/foo.png") == url