@@ -140,7 +140,7 @@ defmodule Mix.Tasks.Hex.Outdated do
140140 end
141141
142142 defp display_table (
143- [ { _package , _dep_only , current , latest , requirements , outdated? , cooldown } ] ,
143+ [ { _repo , _package , _dep_only , current , latest , requirements , outdated? , cooldown } ] ,
144144 [ _app ] ,
145145 _opts
146146 ) do
@@ -198,7 +198,7 @@ defmodule Mix.Tasks.Hex.Outdated do
198198 defp maybe_print_cooldown_legend ( versions ) do
199199 entries =
200200 Enum . flat_map ( versions , fn
201- { package , _ , _ , latest , _ , _ , % { eligible_on: eligible_on } } ->
201+ { _repo , package , _ , _ , latest , _ , _ , % { eligible_on: eligible_on } } ->
202202 [ { package , latest , eligible_on } ]
203203
204204 _ ->
@@ -223,7 +223,7 @@ defmodule Mix.Tasks.Hex.Outdated do
223223
224224 defp set_exit_code ( versions , args , opts ) do
225225 outdated_versions =
226- Enum . filter ( versions , fn { _p , _o , _l , _la , _r , outdated? , cooldown } ->
226+ Enum . filter ( versions , fn { _repo , _p , _o , _l , _la , _r , outdated? , cooldown } ->
227227 outdated? and is_nil ( cooldown )
228228 end )
229229
@@ -301,7 +301,8 @@ defmodule Mix.Tasks.Hex.Outdated do
301301 # deps can have multiple `only` values, so we separate by `,`
302302 only_values = String . split ( only_value , "," , trim: true )
303303
304- Enum . filter ( versions , fn { _package , dep_only , _lock , _latest , _reqs , _outdated? , _c } ->
304+ Enum . filter ( versions , fn { _repo , _package , dep_only , _lock , _latest , _reqs , _outdated? ,
305+ _c } ->
305306 dep_only_parts = String . split ( dep_only , "," )
306307 Enum . any? ( dep_only_parts , & ( & 1 in only_values ) )
307308 end )
@@ -337,7 +338,7 @@ defmodule Mix.Tasks.Hex.Outdated do
337338 end
338339
339340 [
340- { Atom . to_string ( name ) , dep_only , lock_version , latest_version , requirements ,
341+ { repo , Atom . to_string ( name ) , dep_only , lock_version , latest_version , requirements ,
341342 outdated? , cooldown }
342343 ]
343344
@@ -385,7 +386,7 @@ defmodule Mix.Tasks.Hex.Outdated do
385386 List . last ( versions )
386387 end
387388
388- defp format_all_row ( { package , dep_only , lock , latest , requirements , outdated? , cooldown } ) do
389+ defp format_all_row ( { _repo , package , dep_only , lock , latest , requirements , outdated? , cooldown } ) do
389390 latest_color = if outdated? , do: :red , else: :green
390391 req_matches? = req_matches? ( requirements , latest )
391392
@@ -407,15 +408,24 @@ defmodule Mix.Tasks.Hex.Outdated do
407408 ]
408409 end
409410
410- defp build_diff_link ( { package , _dep_only , lock , latest , requirements , outdated? , _cooldown } ) do
411+ defp build_diff_link (
412+ { repo , package , _dep_only , lock , latest , requirements , outdated? , _cooldown }
413+ ) do
411414 req_matches? = req_matches? ( requirements , latest )
412415
413- case { outdated? , req_matches? } do
414- { true , true } -> "diffs[]=#{ package } :#{ lock } :#{ latest } "
415- { _ , _ } -> nil
416+ with true <- outdated? ,
417+ true <- req_matches? ,
418+ comparison_package when is_binary ( comparison_package ) <- diff_package ( repo , package ) do
419+ "diffs[]=#{ comparison_package } :#{ lock } :#{ latest } "
420+ else
421+ _ -> nil
416422 end
417423 end
418424
425+ defp diff_package ( "hexpm" , package ) , do: package
426+ defp diff_package ( "hexpm:" <> organization , package ) , do: "#{ organization } /#{ package } "
427+ defp diff_package ( _repo , _package ) , do: nil
428+
419429 defp version_match? ( _version , nil ) , do: true
420430 defp version_match? ( version , req ) , do: Version . match? ( version , req )
421431
@@ -435,13 +445,17 @@ defmodule Mix.Tasks.Hex.Outdated do
435445 defp diff_link ( diff_links ) do
436446 long_url = "https://hex.pm/diffs?" <> Enum . join ( diff_links , "&" )
437447
438- if Hex.State . fetch! ( :no_short_urls ) do
448+ if Hex.State . fetch! ( :no_short_urls ) or private_comparison? ( diff_links ) do
439449 long_url
440450 else
441451 maybe_get_short_link ( long_url )
442452 end
443453 end
444454
455+ defp private_comparison? ( diff_links ) do
456+ Enum . any? ( diff_links , & String . contains? ( & 1 , "/" ) )
457+ end
458+
445459 defp maybe_get_short_link ( long_url ) do
446460 case Hex.API.ShortURL . create ( long_url ) do
447461 :error -> long_url
@@ -450,8 +464,8 @@ defmodule Mix.Tasks.Hex.Outdated do
450464 end
451465
452466 defp any_possible_to_update? ( outdated_versions ) do
453- Enum . any? ( outdated_versions , fn { _package , _dep_only , _lock , latest , requirements , _outdated? ,
454- _cooldown } ->
467+ Enum . any? ( outdated_versions , fn { _repo , _package , _dep_only , _lock , latest , requirements ,
468+ _outdated? , _cooldown } ->
455469 req_matches? ( requirements , latest )
456470 end )
457471 end
@@ -476,7 +490,9 @@ defmodule Mix.Tasks.Hex.Outdated do
476490 |> Enum . join ( "," )
477491 end
478492
479- defp cast_version_map ( { package , dep_only , lock , latest , requirements , outdated? , cooldown } ) do
493+ defp cast_version_map (
494+ { _repo , package , dep_only , lock , latest , requirements , outdated? , cooldown }
495+ ) do
480496 % {
481497 package: package ,
482498 only: dep_only ,
0 commit comments