Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 29043e7e9eda
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 12b7eefbc5cc
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Apr 16, 2020

  1. Add 'nix flake show' command

    edolstra committed Apr 16, 2020
    Copy the full SHA
    3b489e8 View commit details
  2. Copy the full SHA
    7a9687b View commit details
  3. Copy the full SHA
    12b7eef View commit details
Showing with 497 additions and 9 deletions.
  1. +9 −2 src/libexpr/symbol-table.hh
  2. +2 −2 src/libstore/sqlite.cc
  3. +1 −1 src/libstore/sqlite.hh
  4. +474 −0 src/nix/flake.cc
  5. +11 −4 src/nix/search.cc
11 changes: 9 additions & 2 deletions src/libexpr/symbol-table.hh
Original file line number Diff line number Diff line change
@@ -28,6 +28,12 @@ public:
return s == s2.s;
}

// FIXME: remove
bool operator == (std::string_view s2) const
{
return s->compare(s2) == 0;
}

bool operator != (const Symbol & s2) const
{
return s != s2.s;
@@ -68,9 +74,10 @@ private:
Symbols symbols;

public:
Symbol create(const string & s)
Symbol create(std::string_view s)
{
std::pair<Symbols::iterator, bool> res = symbols.insert(s);
// FIXME: avoid allocation if 's' already exists in the symbol table.
std::pair<Symbols::iterator, bool> res = symbols.emplace(std::string(s));
return Symbol(&*res.first);
}

4 changes: 2 additions & 2 deletions src/libstore/sqlite.cc
Original file line number Diff line number Diff line change
@@ -95,10 +95,10 @@ SQLiteStmt::Use::~Use()
sqlite3_reset(stmt);
}

SQLiteStmt::Use & SQLiteStmt::Use::operator () (const std::string & value, bool notNull)
SQLiteStmt::Use & SQLiteStmt::Use::operator () (std::string_view value, bool notNull)
{
if (notNull) {
if (sqlite3_bind_text(stmt, curArg++, value.c_str(), -1, SQLITE_TRANSIENT) != SQLITE_OK)
if (sqlite3_bind_text(stmt, curArg++, value.data(), -1, SQLITE_TRANSIENT) != SQLITE_OK)
throwSQLiteError(stmt.db, "binding argument");
} else
bind();
2 changes: 1 addition & 1 deletion src/libstore/sqlite.hh
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ struct SQLiteStmt
~Use();

/* Bind the next parameter. */
Use & operator () (const std::string & value, bool notNull = true);
Use & operator () (std::string_view value, bool notNull = true);
Use & operator () (const unsigned char * data, size_t len, bool notNull = true);
Use & operator () (int64_t value, bool notNull = true);
Use & bind(); // null
Loading