Skip to content

Commit 832acca

Browse files
Rename source to url in repository stanza (#11183)
This aligns the naming of `repository` and `pin`, where pin uses `url` and repository used `source` for a field with the same semantics. Signed-off-by: Marek Kubica <[email protected]>
1 parent 5eeb823 commit 832acca

33 files changed

+77
-75
lines changed

doc/tutorials/dune-package-management/repos/dune-workspace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
(repository
77
(name specific-upstream)
8-
(source "git+https://github.com/ocaml/opam-repository.git#00ac3727bc4ac0eabd3c89e69c1660d6b63a3d48"))
8+
(url "git+https://github.com/ocaml/opam-repository.git#00ac3727bc4ac0eabd3c89e69c1660d6b63a3d48"))

src/dune_pkg/workspace.ml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,38 @@ module Repository = struct
2222

2323
type t =
2424
{ name : Name.t
25-
; source : Loc.t * OpamUrl.t
25+
; url : Loc.t * OpamUrl.t
2626
}
2727

2828
let name { name; _ } = name
2929

30-
let to_dyn { name; source = _, source } =
30+
let to_dyn { name; url = _, url } =
3131
let open Dyn in
32-
variant "repository" [ Name.to_dyn name; string (OpamUrl.to_string source) ]
32+
variant "repository" [ Name.to_dyn name; string (OpamUrl.to_string url) ]
3333
;;
3434

35-
let equal { name; source } t =
36-
Name.equal name t.name && Tuple.T2.equal Loc.equal OpamUrl.equal source t.source
35+
let equal { name; url } t =
36+
Name.equal name t.name && Tuple.T2.equal Loc.equal OpamUrl.equal url t.url
3737
;;
3838

39-
let hash { name; source } = Tuple.T2.hash Name.hash Poly.hash (name, source)
39+
let hash { name; url } = Tuple.T2.hash Name.hash Poly.hash (name, url)
4040

4141
let upstream =
4242
{ name = "upstream"
43-
; source =
44-
Loc.none, OpamUrl.of_string "git+https://github.com/ocaml/opam-repository.git"
43+
; url = Loc.none, OpamUrl.of_string "git+https://github.com/ocaml/opam-repository.git"
4544
}
4645
;;
4746

4847
let overlay =
4948
{ name = "overlay"
50-
; source =
49+
; url =
5150
Loc.none, OpamUrl.of_string "git+https://github.com/ocaml-dune/opam-overlays.git"
5251
}
5352
;;
5453

5554
let binary_packages =
5655
{ name = "binary-packages"
57-
; source =
56+
; url =
5857
( Loc.none
5958
, OpamUrl.of_string "git+https://github.com/ocaml-dune/ocaml-binary-packages.git"
6059
)
@@ -65,9 +64,9 @@ module Repository = struct
6564
let open Decoder in
6665
fields
6766
(let+ name = field "name" Name.decode
68-
and+ source = field "source" OpamUrl.decode_loc in
69-
{ name; source })
67+
and+ url = field "url" OpamUrl.decode_loc in
68+
{ name; url })
7069
;;
7170

72-
let opam_url { source; _ } = source
71+
let opam_url { name = _; url } = url
7372
end

test/blackbox-tests/test-cases/pkg/additional-constraints-ocaml-system.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Now make a workspace file adding the constarint on ocaml-system:
4747
> (repositories mock))
4848
> (repository
4949
> (name mock)
50-
> (source "file://$(pwd)/mock-opam-repository"))
50+
> (url "file://$(pwd)/mock-opam-repository"))
5151
> EOF
5252

5353
Solve again. This time ocaml-system is chosen.

test/blackbox-tests/test-cases/pkg/additional-constraints.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ It's possible to include additional packages or constraints in workspace files:
99
> (repositories mock))
1010
> (repository
1111
> (name mock)
12-
> (source "file://$(pwd)/mock-opam-repository"))
12+
> (url "file://$(pwd)/mock-opam-repository"))
1313
> EOF
1414

1515
$ mkrepo

test/blackbox-tests/test-cases/pkg/commit-hash-references.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Use this ref in a project
2323
> (repositories mock))
2424
> (repository
2525
> (name mock)
26-
> (source "git+file://$PWD/mock-opam-repository#$AMBIGUOUS_REF"))
26+
> (url "git+file://$PWD/mock-opam-repository#$AMBIGUOUS_REF"))
2727
> (context
2828
> (default
2929
> (name default)))

test/blackbox-tests/test-cases/pkg/describe-pkg-lock.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ First we setup a repo.
2727
> (repositories mock))
2828
> (repository
2929
> (name mock)
30-
> (source "file://$(pwd)/mock-opam-repository"))
30+
> (url "file://$(pwd)/mock-opam-repository"))
3131
> EOF
3232

3333
Here is the output of solving for multiple contexts:

test/blackbox-tests/test-cases/pkg/duplicate-repositories.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Duplicate repository definition in the same workspace file:
44
> (lang dune 3.11)
55
> (repository
66
> (name foo)
7-
> (source "git+file//$PWD/foo"))
7+
> (url "git+file//$PWD/foo"))
88
> (repository
99
> (name foo)
10-
> (source "git+file//$PWD/foo"))
10+
> (url "git+file//$PWD/foo"))
1111
> EOF
1212

1313
$ dune pkg outdated 2>&1 | awk '/Internal error/,/Raised/'

test/blackbox-tests/test-cases/pkg/env-conditional-dependencies.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Create a workspace config that defines separate build contexts for macos and lin
5151
> (lock_dir dune.macos.lock)))
5252
> (repository
5353
> (name mock)
54-
> (source "file://$(pwd)/mock-opam-repository"))
54+
> (url "file://$(pwd)/mock-opam-repository"))
5555
> EOF
5656

5757
Now the os-specific dependencies are included on their respective systems.

test/blackbox-tests/test-cases/pkg/git-repo.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ We'll set up a project that uses (only this) this repository, so doesn't use
1919
> (repositories mock))
2020
> (repository
2121
> (name mock)
22-
> (source "git+file://$PWD/mock-opam-repository"))
22+
> (url "git+file://$PWD/mock-opam-repository"))
2323
> (context
2424
> (default
2525
> (name default)))

test/blackbox-tests/test-cases/pkg/helpers.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ add_mock_repo_if_needed() {
5252
(repositories mock))
5353
(repository
5454
(name mock)
55-
(source "file://$(pwd)/mock-opam-repository"))
55+
(url "file://$(pwd)/mock-opam-repository"))
5656
EOF
5757
else
5858
if ! grep '(name mock)' > /dev/null dune-workspace
@@ -61,7 +61,7 @@ EOF
6161
cat >>dune-workspace <<EOF
6262
(repository
6363
(name mock)
64-
(source "file://$(pwd)/mock-opam-repository"))
64+
(url "file://$(pwd)/mock-opam-repository"))
6565
EOF
6666

6767
# reference the repo

0 commit comments

Comments
 (0)