0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-28 16:24:56 +01:00
mongodb/copy.bara.sky
Alexander Neben 73c2d9e977 SERVER-90928 Remove lines other than commit title from syncing (#22589)
# Issue

Remove lines other than commit title from syncing

# Description

SERVER-90928 Remove lines other than commit title from syncing to the
public repo

# Testing

This was tested locally. I tested on the commits in this PR and it seems
to be synced correctly. The staging file I used was
```
# This configuration is for migrating code from one Git repository to another using Copybara.
# It selectively copies content, excluding specific paths and preserving authorship.

# To test locally
sourceUrl = "/Users/alexander.neben/workspace/mongo2"
destinationUrl = "/Users/alexander.neben/workspace/mongodb-mongo"

# sourceUrl = "git@github.com:10gen/mongo.git"
# destinationUrl = "git@github.com:10gen/mongo-copybara.git"

core.workflow(
    name = "default",
    origin = git.origin(
        url = sourceUrl,
        ref = "IamXander/prune_commit",
    ),
    destination = git.destination(
        url = destinationUrl,
        fetch = "IamXander/prune_commit",
        push = "IamXander/prune_commit",
    ),
    # Change path to the folder you want to publish publicly
    origin_files = glob(["**"], exclude = ["src/mongo/db/modules/**"]),
    authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
    mode = "ITERATIVE",
    # Change the path here to the folder you want to publish publicly
    transformations = [
        metadata.scrubber("(^.*?)\n((\n|.)*)", replacement = "$1"),
    ],
)
```

Running git log on `/Users/alexander.neben/workspace/mongodb-mongo`
returns the following
```
commit 8a4879557893ae942f793ad707d56e255bebc72d (HEAD -> IamXander/prune_commit)
Author: Alex Neben <alex.neben@mongodb.com>
Date:   Tue May 28 08:55:38 2024 -0700

    fixes

    GitOrigin-RevId: 3ffa6b95d44ec3fef7e715a3f24652966861f4e1

commit 66cdb3631be92ced2123c7e3fab39e24bed91b2b
Author: Alex Neben <alex.neben@mongodb.com>
Date:   Tue May 28 08:50:07 2024 -0700

    SERVER-90928 Remove lines other than commit title from syncing

    GitOrigin-RevId: 7d90f0f69a17943fb68ba23e2f135d08c00c4943

commit 0063834a4fa519727cc6b816995ea56d9b3328fe
Author: Alex Neben <alex.neben@mongodb.com>
Date:   Tue May 28 08:12:24 2024 -0700

    SERVER-XYZ asdasdkjfhaskdf akjdhkjashdkjashd example

    GitOrigin-RevId: 298831cd1d55319ea368fdd2f1dc604368d94889

commit fc7f29486d762a740c3ebe01c3b7d69a477abe75
Author: Alex Neben <alex.neben@mongodb.com>
Date:   Fri May 24 13:55:21 2024 -0700

    prune commit message

    GitOrigin-RevId: 43692434bf664fe593ee7eb5f53372ca331ecec9
```

Which shows no data after the newline. It also does not include
enterprise code.

GitOrigin-RevId: f78828e412e3ac510c6e56feb541146c688b7603
2024-05-28 23:12:16 +00:00

35 lines
1.3 KiB
Plaintext

# This configuration is for migrating code from one Git repository to another using Copybara.
# It selectively copies content, excluding specific paths and preserving authorship.
# To test locally
# sourceUrl = "/path/to/source"
# destinationUrl = "/path/to/dest"
sourceUrl = "git@github.com:10gen/mongo.git"
destinationUrl = "git@github.com:mongodb/mongo.git"
core.workflow(
name = "default",
origin = git.origin(
url = sourceUrl,
ref = "master",
),
destination = git.destination(
url = destinationUrl,
fetch = "master",
push = "master",
),
# Change path to the folder you want to publish publicly
origin_files = glob(["**"], exclude = ["src/mongo/db/modules/**"]),
authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
mode = "ITERATIVE",
# Change the path here to the folder you want to publish publicly
transformations = [
# (^.*?) - matches the first line (without the newline char)
# \n - matches the first newline (or nothing at all if there is no newline). If there is no match then nopthing happens
# ((\n|.)*) - matches everything after
# Overall, this copies only the first line of the commit rather than the body
metadata.scrubber("(^.*?)\n((\n|.)*)", replacement = "$1"),
],
)