Git Product home page Git Product logo

moe's Introduction

Moe

Make Open Easy

LICENSE Travis CI GitHub Issues GitHub Pull Requests

Introduction

MOE is a system for synchronizing, translating, and scrubbing source code repositories. Often, a project needs to exist in two forms, typically because it is released in open-source, which may use a different build system, only be a subset of the wider project, etc. Maintaining code in two repositories is burdensome. MOE allows users to:

  • synchronize (in either or both directions) between two source code repositories
  • use different types of repositories (svn, hg, git) in combinations
  • maintain "scrubbed" content in an internal or private repository.
  • transform project paths to support different layouts/structures in different repositories
  • propagate or hide individual commits, commit-authorship, and other metadata between repositories while syncing.

Project Status

MOE was created around 2011, but has not had a lot of love. Google teams that maintain open-source releases (guava, dagger, auto, etc.) use it regularly, so we dusted it off to share fixes, improvements, and help folks who use it outside of Google.

The project is currently undergoing a fair bit of re-factoring and needs a documentation update, which is forthcoming.

Usage

Building MOE

  1. Install Apache Maven 3.1 if you don't already have it 2. Checkout the Java-MOE source git clone [email protected]:google/MOE.git 3. In the top-level directory that contains the build.xml file, run:
    • mvn install
    • util/make-binary.sh
    1. The moe client binary should be created at client/target/moe

Running MOE

Once you have the moe binary, you should be able to simply run: moe <arguments for MOE>

Contributing

Contributing to MOE is subject to the guidelines in the CONTRIBUTING.md file, which, in brief, requires that contributors sign the Individual Contributor License Agreement (CLA).

License

  Copyright 2011 Google, Inc. All Rights Reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

moe's People

Contributors

blickly avatar cgdecker avatar cgruber avatar chajath avatar concavelenz avatar cpovirk avatar cushon avatar jart avatar kluever avatar lindner avatar matvore avatar ngzhian avatar nick-someone avatar vrana avatar vrusinov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moe's Issues

ERROR: Moe encountered a problem: Error creating draft revision to codebase

When having multiple commits or when executing MOE with git author, which is different from the one who made the commits to sync, the magic directive fails with the error as stated in the title of this issue. It happens due to author dismatch due to author field gets concatenated per each commit;

Can't compile tests: can't find com.google.testing.suitebuilder

Can't find the package "com.google.testing.suitebuilder" anywhere.

I've managed to gather up all the other library dependencies necessary to 
compile src/, but I can't find the dependency "com.google.testing.suitebuilder" 
anywhere online, so I can't compile tests/

from javac:
    [javac] [..]/other/moe-java-read-only/tests/com/google/devtools/moe/client/AllTests.java:5: package com.google.testing.suitebuilder does not exist
    [javac] import com.google.testing.suitebuilder.TestSuiteBuilder;

Original issue reported on code.google.com by [email protected] on 3 Aug 2011 at 11:01

Create a directive to convert a pull-request into a CL

This is being done internally, but wanted to track the feature externally.

It should look something of the form:

moe github_pull --pull_request http://github.com/google/guava/pull/5 --config /path/to/config

The directive should validate that that one of the repositories is a github repository that matches the pull request, and it will attempt to stage the commits on that branch into a client/workspace in the other repository.

This might be more generalizable to something of the form:

moe stage_branch --branch repo_name:foo --root <commit> (if needed) --config /path/to/config

Really a github pull request is just fluff around a branch. But github is by far the more common use-case, so supporting that is the priority.

Cannot migrate to an empty repository ERROR

Magic directive fails with the following exception: Cannot migrate to an empty repository. Follow the steps in "Make the Initial Push."
Since there's no evidence to the documentation of the Initial Push, we had to manually edit moe db json file to specify initial equivalence of both private and public repos revisions. After this is done, flow succeeds.

Should master be compilable?

> ant jar
Buildfile: /Users/jason/ws/reference/MOE/build.xml

clean:
   [delete] Deleting directory /Users/jason/ws/reference/MOE/build

compile:
    [mkdir] Created dir: /Users/jason/ws/reference/MOE/build/classes
    [javac] /Users/jason/ws/reference/MOE/build.xml:33: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 153 source files to /Users/jason/ws/reference/MOE/build/classes
    [javac] /Users/jason/ws/reference/MOE/java/com/google/devtools/moe/client/repositories/Revision.java:12: error: cannot find symbol
    [javac] import com.google.gson.annotations.JsonAdapter;
    [javac]                                   ^
    [javac]   symbol:   class JsonAdapter
    [javac]   location: package com.google.gson.annotations
    [javac] /Users/jason/ws/reference/MOE/java/com/google/devtools/moe/client/repositories/Revision.java:24: error: cannot find symbol
    [javac] @JsonAdapter(AutoValueGsonAdapter.class)
    [javac]  ^
    [javac]   symbol: class JsonAdapter
    [javac] /Users/jason/ws/reference/MOE/java/com/google/devtools/moe/client/database/SubmittedMigration.java:8: error: cannot find symbol
    [javac] import com.google.gson.annotations.JsonAdapter;
    [javac]                                   ^
    [javac]   symbol:   class JsonAdapter
    [javac]   location: package com.google.gson.annotations
    [javac] /Users/jason/ws/reference/MOE/java/com/google/devtools/moe/client/database/SubmittedMigration.java:18: error: cannot find symbol
    [javac] @JsonAdapter(AutoValueGsonAdapter.class)
    [javac]  ^
    [javac]   symbol: class JsonAdapter

BUILD FAILED
/Users/jason/ws/reference/MOE/build.xml:33: Compile failed; see the compiler error output for details.

Total time: 1 second

Doesn't appear to work for me :-(

 find build/classes/
build/classes/
build/classes//com
build/classes//com/google
build/classes//com/google/devtools
build/classes//com/google/devtools/moe
build/classes//com/google/devtools/moe/client
build/classes//com/google/devtools/moe/client/database
build/classes//com/google/devtools/moe/client/database/AutoValue_RepositoryEquivalence.java
build/classes//com/google/devtools/moe/client/database/AutoValue_SubmittedMigration.java
build/classes//com/google/devtools/moe/client/repositories
build/classes//com/google/devtools/moe/client/repositories/AutoValue_Repository.java
build/classes//com/google/devtools/moe/client/repositories/AutoValue_Revision.java

Ran into a problem a bit before when the ant build said it succeeded but the google auto-value processor actually aborted the build, generating a single .java file. Today though, looks like its failing for other reasons, but unsure if its related or not.

Hg Authentication Issues

If you have an Hg repository in your project, you might run into authentication 
issues when Moe tries to clone the Hg repo in HgClonedRepository's 
cloneLocallyAtTip(...) method. Moe tries to clone an Hg repo anytime you try to 
create_codebase, change, or migrate with an Hg repository.

What happens is Moe runs "hg clone" on your repo, but when the repo asks for 
your username and password, Moe crashes instead of letting you enter them.

A temporary solution is to have in your ~/.hgrc a section as follows:

[auth]
moe.prefix = https://path/to/repo
moe.username = [email protected]
moe.password = password

The "moe" before the prefix/username/password can be anything as long as it is 
consistent among the three fields. Make sure the prefix is the same URL as the 
one specified in the moe_config for your Hg repository.

By putting your authentication info in the .hgrc, you shouldn't have to input 
it when "hg clone" is run.


Original issue reported on code.google.com by [email protected] on 25 Aug 2011 at 7:53

MAX_REVISIONS_TO_SEARCH is too small; no command line argument to override it

What steps will reproduce the problem?

I just tried running a 'Moe magic' migration from a git repository which
had 126 commits to migrate. However, due to branching history, Moe
apparently needed to review 406 revisions. As there's no commandline
argument to override MAX_REVISIONS_TO_SEARCH, I had to run a modified
version of Moe in order to migrate.


Suggest either:
- Increasing MAX_REVISIONS_TO_SEARCH by at least an order of magnitude
- Providing a command line flag to override the default

Original issue reported on code.google.com by [email protected] on 31 Jan 2013 at 6:14

Maven build is failing due to the addition of kotlin

For some reason the Kotlin maven plugin (specifically kapt) isn't running correctly - it either processes teh dagger annotation processor in addition to javac doing so, OR (if we exclude the javac build) it doesn't seem to process.

I'm not at Google anymore, as of today, but I"ll try to roll a fix and secure the help of googlers to upstream it.

Create deployment wrappers for unix, mac, windows for the tool.

We need a way of either having an executable download, or an archive whose exploded contents contains an executable, likely a wrapper script.

My preference is to have a "moe" script which contains the zip of the output, and automatically silently puts it somewhere so you just run it, and it just works, at least for mac/linux, but a zip with a bin/lib split is fine.

Is the project still alive? [*No* trolling meant]

Hi,
Wanted to know if the project is still alive since a lot of issues were opened a few months ago but the last activity was 3 months ago.
Most disturbing actually is the open PR which wasn't even acknowledged over 4 months ago.
The reason I'm asking is because I have this need of syncing OS libraries from a monorepo and MOE sounds really interesting.
We're currently doing it manually and it, obviously, has a lot of drawbacks. I'm also looking at FBShipIt but the hack angle is less appealing then Java.
If the project is alive I'd be happy to try and contribute if possible.

Sparse checkout for repository subdirectories

Sometimes there may be a very large repository in HG & Git in which one wants 
to open source only one certain directory, such as a sub-project or particular 
library.

As far as I can tell, currently the only way to do this is to write a bunch of 
editors which delete all folders that aren't being open sourced. This is far 
from optimal, as fetching the other folders could be expensive operation, and 
writing scrubbers for very complicated (dozens of folders) repositories for 
every open source project is error prone. It would be easier to limit a 
repository to a certain path.


Enhancement: Sparse checkout

Include an optional "path" field in the repository JSON object in the config 
file:
"internal": {
  "type": "hg",
  "url":  "file:///home/mbethencourt/work/test_repos/hg_0",
  "project_space": "internal",
  "path": "subproject/libraryname"
},

* Without a "path", MOE falls back to old behavior (operating on entire repo).
* With a path, MOE tries to use "sparse" checkout feature. A "renamer" 
translator will still probably be used to make the layout match external layout.

Sparse checkouts would be implemented a little differently for each client:
* Git would use the sparse checkout feature ( 
http://blog.quilitz.de/2010/03/checkout-sub-directories-in-git-sparse-checkouts/
 )
* SVN would use either "--non-recursive" or "--depth empty", and then "update" 
or "--depth infinite" the specified path
* HG, unfortunately, does not seem to have a sparse checkout feature. It can 
still be imitated however by cobbling together a few commands.

Original issue reported on code.google.com by [email protected] on 23 Aug 2011 at 9:15

NullPointerException in AbstractRevisionHistory when MAX_REVISIONS_TO_SEARCH is exceeded in the default case

What steps will reproduce the problem?

Try to 'Moe magic' a repository with > MAX_REVISIONS_TO_SEARCH (=400)
revisions to visit.

Results in NullPointerException in AbstractRevisionHistory.java:60,
specifically, `revision` is null in the following block of code:

        if (visited.size() > MAX_REVISIONS_TO_SEARCH) {
          throw new MoeProblem(String.format(
              "Couldn't find a matching revision for matcher (%s) in repo %s within %d revisions.",
              matcher,
              revision.repositoryName,
              MAX_REVISIONS_TO_SEARCH));
        }

Original issue reported on code.google.com by [email protected] on 31 Jan 2013 at 6:16

Determine this repo's direction and policy for 2019

There are a few teams which use MOE, and which need fixes, outside of Google. Some teams inside google use MOE, others have migrated to Copybara (github.com/google/copybara). Officially, Copybara is the successor to MOE, but has a different set of use-cases and assumptions.

We should decide whether this open-source repo is going to be updated, and accept patches, or whether it is officially sun-setted, as its earlier maintainer (@cgruber) is willing to continue to patch and update it, but is not at Google, and needs either to spin up a fork or to be re-empowered to make merges on this repository.

Patch to add HTTP support for configuration file

I added HTTP support to MOE for the --project_config and --db paths.
With this patch, you can now do stuff like:

  java -jar moe.jar check_config --config_file http://server/project_config

This patch makes it so a company can use a simple REST API internally for 
maintaining projects, and not have to worry about everything necessarily being 
on NFS. It is backward compatible with old usage: if a path is given (without a 
file:// or http:// scheme specifier), it will assume it is a file.

Here is the patch:     https://gist.github.com/1158363





Additionally, I wrote two quick Python scripts for testing and/or reference for 
this new feature.

I wrote a tiny example HTTP server:
* https://gist.github.com/1158377
  moe_config_server.py is a simple example server that implements the
REST api just mentioned. It takes a single argument, which is the port it will 
run on (defaults to 8080). It serves up "./projects/[project_name]/config.js" 
and "./projects/[project_name]/moe.db"

To make calling MOE repeatedly, I wrote a tiny wrapper Python script:
* https://gist.github.com/1158379
moe.py wraps around the main MOE adding arguments based on what it finds in a 
JSON file, "~/.moerc". This saves the user from having to type --test_config 
and --db with every call, and works with the above example server. With moe.py, 
you can just do commands like "moe.py project_name check_config"

Original issue reported on code.google.com by [email protected] on 23 Aug 2011 at 9:29

Mime types in SVN

Moe Python sets mime types automatically for SVN
http://code.google.com/p/make-open-easy/source/browse/trunk/moe/svn.py

Moe Java should do this as well.


Original issue reported on code.google.com by Nicholas.J.Santos on 21 Nov 2011 at 8:33

Starter flow instructions are missing

Hi,
we're trying to play with MOE, so we started with two simple GIT repos with identical content, and we would like to see how we can sync our commits from one repo to another.
We could not find in the documentation the directives' sequence to follow in order to achieve our goal.
Is it possible to share the steps to take for this basic flow: two repos start with identical content, then the first repo is promoted with a commit, and finally, sync the commit to the second repo.

Thanks!

Build failing on Cygwin

Not sure if this is likely to be considered important, but... with:

  • JAVA_HOME set to a 1.8 JDK
  • Maven for Windows installed and added to PATH.
  • Guava dependency updated as per this pull request.

Ran mvn install and got a large number of tests failed. Looks like it's related to path separators.

Tests in error: 
  testOneSubmittedMigration_equivalent(com.google.devtools.moe.client.directives.BookkeepingDirectiveTest): String index out of range: -1
  testHeadsEquivalent(com.google.devtools.moe.client.directives.BookkeepingDirectiveTest): String index out of range: -1
  testOneSubmittedMigration_nonEquivalent(com.google.devtools.moe.client.directives.BookkeepingDirectiveTest): String index out of range: -1
  testLongStderr(com.google.devtools.moe.client.SystemCommandRunnerTest): Running perl with args [-e, print STDERR ("*" x 17000)] returned 255 with stdout  and stderr Number found where operator expected at -e line 1, near "* x 17000"(..)
  testLongStdout(com.google.devtools.moe.client.SystemCommandRunnerTest): Running perl with args [-e, print ("*" x 17000)] returned 255 with stdout  and stderr Number found where operator expected at -e line 1, near "* x 17000"(..)
  testFileToString(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testSetLifetime(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\tmp\moe_persistent_0
  testCleanUpTempDirs(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\tmp\moe_persistent_0
  testWrite(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\src
  testListFiles(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testIsDirectory(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testCopyFile(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testMakeDirs(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\a\b\c\d
  testMakeDirsForFile(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\a\b\c\d
  testFindFiles(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testGetResourceAsFile(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\tmp\moe_resource_extraction__0\test_resource
  testExists(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testIsFile(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): String index out of range: -1
  testGetTemporaryDirectory(com.google.devtools.moe.client.testing.InMemoryFileSystemTest): An absolute path was expected: C:\tmp\moe_pineapple_0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.