mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Merge branch 'master' into 2.2.0
- merge of 2.1.2 release being now the current released version in master. Conflicts: CMakeLists.txt NEWS test/bug.1104.t test/run_all
This commit is contained in:
commit
a3242f7b5b
19 changed files with 175 additions and 79 deletions
|
@ -503,6 +503,7 @@ void Context::shadow ()
|
|||
{
|
||||
std::string file_name = config.get ("shadow.file");
|
||||
std::string command = config.get ("shadow.command");
|
||||
std::string rcfile = rc_file;
|
||||
|
||||
// A missing shadow file command uses the default command instead.
|
||||
if (command == "")
|
||||
|
@ -534,13 +535,14 @@ void Context::shadow ()
|
|||
|
||||
// Compose the command. Put the rc overrides up front, so that they may
|
||||
// be overridden by rc.shadow.command.
|
||||
command = program +
|
||||
" rc.detection:off" + // No need to determine terminal size
|
||||
" rc.color:off" + // Color off by default
|
||||
" rc.gc:off " + // GC off, to reduce headaches
|
||||
command + // User specified command
|
||||
" >" + // Capture
|
||||
shadow_file._data; // User specified file
|
||||
command = program +
|
||||
" rc.detection:off" + // No need to determine terminal size
|
||||
" rc.color:off" + // Color off by default
|
||||
" rc.gc:off " + // GC off, to reduce headaches
|
||||
" rc:" + rcfile + " " + // Use specified rc file
|
||||
command + // User specified command
|
||||
" >" + // Capture
|
||||
shadow_file._data; // User specified file
|
||||
|
||||
debug ("Running shadow command: " + command);
|
||||
system (command.c_str ());
|
||||
|
|
|
@ -1024,8 +1024,8 @@ void TDB2::merge (const std::string& mergeFile)
|
|||
mods.splice (mods.begin (), rmods);
|
||||
|
||||
DEBUG_STR ("sorting taskmod list");
|
||||
mods.sort ();
|
||||
mods_history.sort ();
|
||||
mods.sort (compareTaskmod);
|
||||
mods_history.sort (compareTaskmod);
|
||||
}
|
||||
else if (rit == r.end ())
|
||||
{
|
||||
|
@ -1232,7 +1232,7 @@ void TDB2::merge (const std::string& mergeFile)
|
|||
// at this point undo contains the lines up to the branch-off point
|
||||
// now we merge mods (new modifications from mergefile)
|
||||
// with lmods (part of old undo.data)
|
||||
lmods.sort();
|
||||
lmods.sort(compareTaskmod);
|
||||
mods.merge (lmods);
|
||||
mods.merge (mods_history);
|
||||
|
||||
|
|
|
@ -33,22 +33,38 @@
|
|||
#include <assert.h>
|
||||
#include <Taskmod.h>
|
||||
|
||||
unsigned long Taskmod::curSequenceNumber = 0;
|
||||
|
||||
bool compareTaskmod (Taskmod first, Taskmod second)
|
||||
{
|
||||
if (first._timestamp == second._timestamp)
|
||||
{
|
||||
return first._sequenceNumber < second._sequenceNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
return first._timestamp < second._timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Taskmod::Taskmod ()
|
||||
{
|
||||
_timestamp = 0;
|
||||
_bAfterSet = false;
|
||||
_bBeforeSet = false;
|
||||
_sequenceNumber = curSequenceNumber++;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Taskmod::Taskmod (const Taskmod& other)
|
||||
{
|
||||
this->_before = other._before;
|
||||
this->_after = other._after;
|
||||
this->_timestamp = other._timestamp;
|
||||
this->_bAfterSet = other._bAfterSet;
|
||||
this->_bBeforeSet = other._bBeforeSet;
|
||||
this->_before = other._before;
|
||||
this->_after = other._after;
|
||||
this->_timestamp = other._timestamp;
|
||||
this->_bAfterSet = other._bAfterSet;
|
||||
this->_bBeforeSet = other._bBeforeSet;
|
||||
this->_sequenceNumber = other._sequenceNumber;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -87,11 +103,12 @@ Taskmod& Taskmod::operator= (const Taskmod& other)
|
|||
{
|
||||
if (this != &other)
|
||||
{
|
||||
this->_before = other._before;
|
||||
this->_after = other._after;
|
||||
this->_timestamp = other._timestamp;
|
||||
this->_bAfterSet = other._bAfterSet;
|
||||
this->_bBeforeSet = other._bBeforeSet;
|
||||
this->_before = other._before;
|
||||
this->_after = other._after;
|
||||
this->_timestamp = other._timestamp;
|
||||
this->_bAfterSet = other._bAfterSet;
|
||||
this->_bBeforeSet = other._bBeforeSet;
|
||||
this->_sequenceNumber = other._sequenceNumber;
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
@ -100,9 +117,10 @@ Taskmod& Taskmod::operator= (const Taskmod& other)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Taskmod::reset (long timestamp)
|
||||
{
|
||||
this->_bAfterSet = false;
|
||||
this->_bBeforeSet = false;
|
||||
this->_timestamp = timestamp;
|
||||
this->_bAfterSet = false;
|
||||
this->_bBeforeSet = false;
|
||||
this->_timestamp = timestamp;
|
||||
this->_sequenceNumber = curSequenceNumber++;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -177,6 +195,12 @@ void Taskmod::setTimestamp (long timestamp)
|
|||
this->_timestamp = timestamp;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Taskmod::incSequenceNumber ()
|
||||
{
|
||||
this->_sequenceNumber++;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Task& Taskmod::getAfter ()
|
||||
{
|
||||
|
@ -195,6 +219,12 @@ long Taskmod::getTimestamp () const
|
|||
return _timestamp;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
unsigned long Taskmod::getSequenceNumber () const
|
||||
{
|
||||
return _sequenceNumber;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Taskmod::getTimeStr () const
|
||||
{
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <Task.h>
|
||||
|
||||
class Taskmod {
|
||||
friend bool compareTaskmod (Taskmod first, Taskmod second);
|
||||
|
||||
public:
|
||||
Taskmod ();
|
||||
Taskmod (const Taskmod& other);
|
||||
|
@ -59,11 +61,13 @@ public:
|
|||
void setAfter (const Task& after);
|
||||
void setBefore (const Task& before);
|
||||
void setTimestamp (long timestamp);
|
||||
void incSequenceNumber ();
|
||||
|
||||
// getter
|
||||
Task& getAfter ();
|
||||
Task& getBefore ();
|
||||
long getTimestamp () const;
|
||||
unsigned long getSequenceNumber () const;
|
||||
std::string getTimeStr () const;
|
||||
|
||||
protected:
|
||||
|
@ -72,7 +76,12 @@ protected:
|
|||
long _timestamp;
|
||||
bool _bAfterSet;
|
||||
bool _bBeforeSet;
|
||||
unsigned long _sequenceNumber;
|
||||
|
||||
static unsigned long curSequenceNumber;
|
||||
};
|
||||
|
||||
bool compareTaskmod (Taskmod first, Taskmod second);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue